Re: Re: [PHP] Re: Random
| From: | (David) | Date: | Thu, 20 Dec 2001 01:47:25 +0000 |
| Subject: | Re: Re: [PHP] Re: Random | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-78280@lists.php.net to get a copy of this message | ||
yeah, my linux(Mandrake 8, Apache 1.3.22, PHP 4.1.0) box also gives me a 6 digit integer each time
too.
but when i tried on my win32 (Win2k, Apache 1.3.22, PHP 4.1.0), it is limited to a max of 32767 as
indicated with getrandmax(). the origional author of the problem probably using windows too :)
>> should be because rand() can\'t generate such a large number for u.
>>
>> use $max_random_number = getrandmax(); to check
>>
>> http://sg.php.net/manual/en/function.getrandmax.php
>
>Hmmm... My webserver gives me no problems witht this at >all.
>(Sun E250 with Solaris 8, Apache 1.3.20 and PHP4.6)
>This :
><?PHP
>$floor = 100000;
>$ceiling = 999999;
>srand((double)microtime()*1000000);
>$random = rand($floor, $ceiling);
>print $random;
>?>
>Gives me a 6-digit integer every time