Re: Netscape rand() not random

From: Date: Wed, 17 Jan 2001 19:04:09 +0000
Subject: Re: Netscape rand() not random
Groups: php.general 
Request: Send a blank email to php-general+get-35114@lists.php.net to get a copy of this message
Ah! excellent, it works fine now. I must apparently skipped that line about seeding it in the php documentation. (doh!) I wonder why IE5.5 didnt need the seeding in order to do the rand()? Thanks alot, Joel --- Romulo Roberto Pereira <php@diffdev.com> wrote: > 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 > __________________________________________________ Do You Yahoo!? Get email at your own domain with Yahoo! Mail. http://personal.mail.yahoo.com/

« previous php.general (#35114) next »