Re: Random

From: Date: Mon, 29 Oct 2001 07:47:29 +0000
Subject: Re: Random
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-72685@lists.php.net to get a copy of this message
$ceiling is too big. try to do this and see: echo getrandmax(); you might get 32767 as an output! therefore, $ceiling must be <= getrandmax(); try to scale down your floor and ceiling, ie: $max = $ceiling - $floor; $random = rand(0, $max) + $floor; "Andrew Duck" <necro@exclusionzone.com> wrote in message news:005f01c15ea6$30375800$0100007f@localhost... #Create Random number $floor = 100000; $ceiling = 999999; srand((double)microtime()*1000000); $random = rand($floor, $ceiling); Warning: rand(): Invalid range: 100000..999999 in c:\my documents\ezone\testing\signup2.php on line 49 Can someone please tell me where i went wonr gin this coding. Thanks

« previous php.general (#72685) next »