Re: Random number generator

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



WEISD wrote:


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.

Stephen

I 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...

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";

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux