Bug #11108 Updated: Problem in rand() on win2000 (or all win32?)

From: Date: Sun, 22 Jul 2001 19:55:22 +0000
Subject: Bug #11108 Updated: Problem in rand() on win2000 (or all win32?)
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-60659@lists.php.net to get a copy of this message
ID: 11108 Updated by: andy Reported By: djewett@usd.edu Old Status: Open Status: Closed Bug Type: Math related Operating System: Windows 2000 SP2 PHP Version: 4.0.5 New Comment: try using a better seed for the random number, such as srand((double) microtime() * 1000000); this fixed the problem on my machine. Previous Comments: ------------------------------------------------------------------------ [2001-05-25 04:02:39] djewett@usd.edu // Sample code for problem srand(time()); for($counter = 0; $counter<= 20 ; $counter++){ print(rand(0,5 ); print("<br>"); } for some reason this always returns the same number as the first number returned, until the file is modified. The first number, after that, the numbers seem to be random. I'm using the latest apache & php on a win2k SP2 laptop ------------------------------------------------------------------------ Edit this bug report at http://bugs.php.net/?id=11108&edit=1

« previous php.dev (#60659) next »