random number problem...

From: Date: Tue, 10 Jul 2001 21:39:13 +0000
Subject: random number problem...
Groups: php.general 
Request: Send a blank email to php-general+get-57246@lists.php.net to get a copy of this message
Hi, I've written a picture rotation script, file paths are stored in a file and are called depending on a random number generator.. The problem is that out of 14 possible numbers only 7 are been generated. the code I'm using is... srand ( (double) microtime()*10000000); $numbertodisplay = rand(0, (($no_items)-1)); The variable $numbertodisplay only ever takes the values 0,2,4,6,8,10,12. Is there a reason that the only numbers produced are even? Thanks for any help.. James

« previous php.general (#57246) next »