Seed the random number generator:
<?php
mt_srand(mktime());
echo(mt_rand());
?>
Try it Yourself »
The mt_srand() function seeds the Mersenne Twister random number generator.
mt_srand(
seed,
mode);
Parameter | Description |
---|---|
seed | Optional. Specifies the seed value |
mode | Optional. Specifies the algorithm to use. Can be one of the following constants:
|
Return Value: | None |
---|---|
Return Type: | - |
PHP Version: | 4+ |
PHP Changelog: | PHP 4.2.0: Random number generator is now seeded automatically |
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!