PHP functions Mt_rand () and Rand () will have a chance of repeating random numbers when they are generated in batches. Srand () and Mt_srand () are not explicitly invoked at the beginning of PHP4.1, and seeds are automatically generated at Mt_rand and Rand. Because, in batches of random, we use the explicit bar to generate seeds, we can avoid duplication. Why, then? Because the seeds are different. Why is the seed different? Because he is the seed of time.
<?php
Storing the random number of lives
$RANDARR = Array ();
Generate 100,000.
For ($i =0 $i <100000; $i + +) {
Generate seeds
$date = Explode (', microtime ());
$seed = $date [0];
Seed generator
Mt_srand ($seed);
Generate random numbers
$RANDARR [] = Mt_rand ();
}
?>
Random numbers are generated. And it won't be repeated oh. The advantage of time is to omit the procedure of do{to generate random number Code}while (!isset (a random number of freshmen) when a common pseudo-random number is duplicated.