Re: Random number generator
| From: | Maciek Sokolewicz | Date: | Thu, 06 Nov 2008 17:20:55 +0000 |
| Subject: | Re: Random number generator | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-283009@lists.php.net to get a copy of this message | ||
WEISD wrote:
1. change the number to a string: $t = (string) time(); 2. chop off the last char of the string: $char = substr($t, -1); 3. you're done...: include "footer$char.html";Computer functions to generate random numbers are not designed to do what their name suggests. Software testing requires repeatability, and this includes random number generation. Without knowing how PHP seeds the generator it is difficult to predict what it will do. I still think taking the last digit of the current time is your best solution. StephenI like the idea of using the time but don't like the idea of spending the rest of the day learning how to parse out the numbers I need from the time...