Re: RAND, SRAND Not random....
| From: | Philip Olson | Date: | Sun, 19 Nov 2000 08:06:19 +0000 |
| Subject: | Re: RAND, SRAND Not random.... | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-26110@lists.php.net to get a copy of this message | ||
Works for me just fine.
--
be outside the box.
On Sun, 19 Nov 2000, Jeff Gannaway wrote:
> 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
>
>
>
> --
> 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
>