you need to seed the rand with srand() before the rand() command...

cheers,

Rom
----- Original Message ----- 
From: Joel Dossey <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to