The first of these methods The second method of The third method of Isn't this the same as the one below? are random output 10-100 between the number of new students learning, may ask too simple OH Mt_rand (10,100); Srand is a seed, and if it's not, the default is 1 rand is generally a fixed operation that uses seed to make parameters. You know, without seeding or setting a fixed seed, running Rand and then closing the browser and then running Rand you'll find the results are always the same first say Rand () function bar, rand ([int min], [int max]) This function takes a random number between Min and Max. Without specifying the maximum and minimum range of random numbers, this function automatically takes a random number from 0 to Rand_max. However, if only rand () is used, the random number is very chaotic and it is best to use the Srand () function to configure a new random number seed each time before taking a random number. Explain the following usage (which is generally the case with these two functions): Srand (Double) microtime () *1000000); $rand _number= rand (); Microtime () returns two values: the current millisecond and timestamp, we want to extract the random number, only a random number from the millisecond, (double) microtime () only returns the current millisecond value. Microtime () is the number of milliseconds in seconds, and the value is a decimal, multiplied by 1000000 to convert it to integers. The workflow is as follows: (1): First, give Srand () a "seed", which is a value of type Unsigned_int. (2): _ Then, call Rand (), which returns a random number (in the range between _0~32767) based on the value provided to Srand () (3): Call rand () as many times as necessary to keep getting new random numbers. (4): Whenever you can provide Srand () with a new "seed", further "Randomize" rand () output results.
http://www.bkjia.com/PHPjc/477855.html www.bkjia.com true http://www.bkjia.com/PHPjc/477855.html techarticle The first method? PHP $FileID =date (ymd-his). rand (100,999);//$FileID a random number such as 20100903-132121-908? The second method? PHP function ran Domkeys ($length) {$returnS ...