Use a random number in PHP. I want to create a random webpage, but I cannot use rand (). I heard that I want to initialize the random number, but how can I initialize it? please kindly advise. thank you! Step 1: initialize the seed. I want to create a random webpage, but I cannot use rand (). I heard that I want to initialize the random number, but how can I initialize it? please don't hesitate to give me some advice. thank you!
// Step 1: initialize the seed
$ Seedarray = microtime ();
$ Seedstr = split ("", $ seedarray, 5 );
$ Seed = $ seedstr [0] * 10000;
// Step 2: Use the seed to initialize the random number generator
Srand ($ seed );
// Step 3: generate a random number within the specified range
$ Random = rand (10, 40 );
Random () means no. I heard that we want to initialize the random number, but how to initialize it? please don't hesitate to give me some advice. thank you! // Step 1: initialize the seed...