PHP Wysardry
PHP Manual

PHP documentation.



Home / PHP / Manual / ...



PHP Manual
Prev Next

srand

(PHP 3 <= 3.0.18, PHP 4 >= 4.0.0)

srand -- Seed the random number generator

Description

void srand (int seed)

Seeds the random number generator with seed.

// seed with microseconds
function make_seed() {
    list($usec, $sec) = explode(' ', microtime());
    return (float) $sec + ((float) $usec * 100000);
}
srand(make_seed());
$randval = rand();

See also rand(), getrandmax(), mt_rand(), mt_srand(), and mt_getrandmax().


Prev Manual Home Next
sqrt Up tan
Site Menu

Amazon.ca
Amazon.com
Amazon.co.uk



Most recently updated on 11 May, 2003

Home / PHP / Manual / ...



Please feel free to contact us with any comments or suggestions
PHP Manual
PHP Wysardry

This site is hosted by Spaceports