Seeding a random number generator:
<?phpmt_srand(mktime());echo(mt_rand());?>The mt_srand() function seeds the Mersenne Twister random number generator.
Tip: Starting with PHP 4.2.0, the random number generator is automatically seeded, so there is no need to use this function.
mt_srand( seed );
parameter | describe |
---|---|
seed | Optional. Specifies seeding value. |
Return value: | none. |
---|---|
Return type: | - |
PHP version: | 4+ |
PHP change log: | PHP 4.2.0: Random number generator automatically seeded. |