RE: Random number generator

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

 



[snip]
<?php
$number = rand(1, 10);

include("footer$number.html"); ?>

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 always with an occasional
2 or 
4 here and there...
[/snip]

So there fore it is random, or at least as random as it can be. If you
want it to be random but not be the same as the last value generated you
have to do some more complex programming. But then you have really made
things less random. 

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