srand

Seed the random number generator

Note: There is no need to seed the random number generator with srand() as this is done automatically.

Syntax

srand ([ int $seed ] ) : void

Parameters

seed

An arbitrary integer seed value.

Return

No value is returned.

Examples

1 · void

<?

srand();

$randreturn = rand();

echo $randreturn;

?>
1309954122

2 · seed

<?

$seed = time();

srand($seed);

$randreturn = rand();

echo $randreturn;

?>
592005992

getrandmax

lcg_value

mt_getrandmax

mt_rand

mt_srand

rand

PHP

Home Menu