The mt_srand() function seeds the random number generator.
Note − Random number generator is seeded automatically after the release of PHP 4.2.0. This function is not needed now.
Syntax
srand(seed)
Parameters
seed − The seed value
Return
The srand() function Returns nothing.
Example
<?php srand(mktime()); echo(mt_rand()); ?>
Output
664617053
Example
Let us see another example −
<?php srand(2); echo(rand(1, 5)); ?>
Output
4