random numbers

From: Date: Mon, 11 Nov 2002 23:52:30 +0000
Subject: random numbers
Groups: php.general 
Request: Send a blank email to php-general+get-123917@lists.php.net to get a copy of this message
Hi! I'm using the following method to generate 5 random lottery numbers: /* srand is not important since php v>=4.2.0 */ $numbers = range (1,90); $x = array_rand ($numbers, 5); foreach ($x as $v) echo "{$numbers[$v]} "; It works fine, except the first query: php may restart the random numbers, if it is not used for some seconds. What should i do to get rid of this problem? I want to use array_rand(), (so I don't want to use mt_rand) because it's more nice than a complicated selecting method... I'm using Apache/1.3.27 (Win32) PHP/4.2.2 Thanks in advance

« previous php.general (#123917) next »