Re: Random Numbers

From: Date: Wed, 29 Nov 2000 18:33:30 +0000
Subject: Re: Random Numbers
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-27843@lists.php.net to get a copy of this message
Jason Murray wrote: > > Gary, > > > My problem, when the numbers print they print like this. > > 703 > > 7031 > > 70310 > > > > Does anyone know how to get different random numbers to print on the > > same page, Without the above happening? > > It looks like you haven't seeded the random number generator? > > <? > srand ((double) microtime() * 1000000); > $number1 = rand(111, 999); > $number2 = rand(1111, 9999); > $number3 = rand(11111, 99999); > ?> > > This Should(tm) (in an off-the-cuff kinda way) work. > > Jason > Look in the manual for mt_rand(). It is better than rand(). I think this question was asked just a couple days ago on this list... Greetings, Jason - the other JM -- Jason Murray Developer jWeb New Media Design 1 877 525 jWEB

« previous php.general (#27843) next »