The mt_srand() function seeds the Mersenne Twister random number generator.
PHP mt_srand() Function has the following syntax.
mt_srand(seed);
Parameter | Is Required | Description |
---|---|---|
seed | Optional. | Seed value |
None
Seed the random number generator:
<?php
mt_srand(mktime());
echo(mt_rand());
?>
The code above generates the following result.