srand

(PHP 3, 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().