RAND, SRAND Not random....

From: Date: Sun, 19 Nov 2000 01:12:46 +0000
Subject: RAND, SRAND Not random....
Groups: php.general 
Request: Send a blank email to php-general+get-26105@lists.php.net to get a copy of this message
Okay, I've never had this problem before with SRAND and RAND. For some reason, out of 18 possibilities, the following routine only goes through the same 4 or 5 possibilities. <? $Calendars = array ("CAL0001", "CAL0002", "CAL0003", "CAL0004", "CAL0005", "CAL0006", "CAL0007", "CAL0008", "CAL0009", "CAL0010", "CAL0011", "CAL0012", "CAL0013", "CAL0014", "CAL0015", "CAL0016", "CAL0017", "CAL0018"); $Name = array ("Classic Jazz", "Van Gogh", "M.C. Escher", "Maxfield Parrish", "Jacob Lawrence", "Women Of The African Ark", "James VanDerZee", "Frank Lloyd Wright", "Alphonse Mucha", "Edward Hopper's New England", "GalPals", "Women Who Dare", "Classical Music", "Charles Rennie Mackintosh", "Georgia O'Keeffe", "The Blues", "Navajo Textiles", "Edward S. Curtis"); $CalSize = sizeof($Calendars)-1; srand ((double) microtime() * 1000000); $x = rand(0, $CalSize); PRINT $Calendars[$x]; ?> Thanks in advance, Jeff Gannaway

« previous php.general (#26105) next »