Re: Netscape rand() not random
| From: | Romulo Roberto Pereira | Date: | Wed, 17 Jan 2001 18:51:08 +0000 |
| Subject: | Re: Netscape rand() not random | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-35106@lists.php.net to get a copy of this message | ||
you need to seed the rand with srand() before the rand() command...
cheers,
Rom
----- Original Message -----
From: Joel Dossey <smokin_joel@yahoo.com>
To: <php-general@lists.php.net>
Sent: Wednesday, January 17, 2001 1:39 PM
Subject: [PHP] Netscape rand() not random
Hello,
I have been toying with php for a short while and have
problems getting the following code to correctly
execute on Netscape:
<?php
header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y
H:i:s",getlastmod())." GMT");
header ("Cache-Control: no-cache, must-revalidate");
header ("Pragma: no-cache");
for($i=0; $i<40; $i++)
{
$rand= rand(1, 40);
print "$rand<BR>";
}
?>
I included the headers because I thought this would
prevent caching, but even still, everytime I reload
and shift-reload Netscape (browser cache is set to
zero) I receive the same output from first access,
which really ruins any true random activity. Any
ideas?
thanks much,
Joel Dossey
__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail.
http://personal.mail.yahoo.com/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net