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

void

<?

srand();

$randreturn = rand();

echo $randreturn;

?>
1607593717

seed

<?

$seed = time();

srand($seed);

$randreturn = rand();

echo $randreturn;

?>
1752766880

PHP

Home Menu