Re: [PHP] Random number generator

2008-11-06 Thread WEISD
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"; Time wins certainly produces better results, at least for what I am doing, than rand... Thanks all for your input...

Re: [PHP] Random number generator

2008-11-06 Thread WEISD
http://www.weisd.com/store2/WINHD-9022.php Not me -- I get a normal distribution. Cheers, tedd Thanks Tedd, That is because it is using time now and not rand... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Random number generator

2008-11-06 Thread WEISD
That is strange. I get pretty balanced results on this computer. Andrew Simple code, You can see it in action here at the bottom of the page there is a footer. Each footer is the same right now except I have numbered them for testing. As I refresh the page, I get footer10 almost alwa

Re: [PHP] Random number generator

2008-11-06 Thread WEISD
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 taki

Re: [PHP] Random number generator

2008-11-06 Thread WEISD
""Gary M. Josack"" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Stephen wrote: On a php web page I want to generate a random number between say 1 and 10 and then use that number to reference a particular file in an include tag. Is there an easy way to do this? Get the tim

Re: [PHP] Random number generator

2008-11-05 Thread WEISD
e a number of things you can do with that to select a random file and include it. Have an associative array where the random number matches an array key and the value is the filename you want, is one method. Just starting out with PHP or is this a homework assignment? :) -TG - Original Mess

[PHP] Random number generator

2008-11-05 Thread WEISD
On a php web page I want to generate a random number between say 1 and 10 and then use that number to reference a particular file in an include tag. Is there an easy way to do this? Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub