PHP function mt_srand description
void mt_srand (int seed)
Use seed to give Random number generator seeding. Starting from PHP version 4.2.0, the seed parameter becomes optional, and when it is empty, it will be set to a constant.
Example 1. PHP function mt_srand example
- < ?php
- // seed with microseconds
- function make_seed()
- {
- list($usec, $sec) = explode
(' ', microtime()); - return (float) $sec +
((float) $usec * 100000); - }
- mt_srand(make_seed( ));
- $randval = mt_rand();
- ?>
Note: Since PHP 4.2.0, it is no longer necessary to seed the random number generator with srand() or the PHP function mt_srand, it is now done automatically.
See mt_rand(), mt_getrandmax() and srand().
http://www.bkjia.com/PHPjc/446043.html
www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/446043.htmlTechArticlePHP function mt_srand description void mt_srand (int seed) Use seed to seed the random number generator. Starting from PHP version 4.2.0, the seed parameter becomes optional. When it is empty, it will be set to random...