Re: Using rand() for 10 digit numbers????
| From: | Scott Fletcher | Date: | Fri, 05 Sep 2003 17:28:33 +0000 |
| Subject: | Re: Using rand() for 10 digit numbers???? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-161793@lists.php.net to get a copy of this message | ||
How interesting. Yours work while mine doesn't. All I did was ..
--snip--
$randomNumber = rand(0,9999999999);
echo $randomNumber;
--snip--
What PHP version do you use? I only have version 4.3.1 on the machine.
"Jay Blanchard" <jay.blanchard@niicommunications.com> wrote in message
news:C8F323573C030A448F3E5A2B6FE2070B02A1D2@nemesis...
[snip]
I looked at the rand() at php.net which spoke about min and max
random
number. So, I use rand(0,9999999999) to get a 10 digit random number
but it
only return an 1 digit random number that is displayed at '0'. So, I
tried
rand(0,9999) with 4 digit random number and got the random number. So,
why
does it not work with 10 digit numbers?
[/snip]
How may tests did you run? I just did this ....
901,476,090
1,161,662,632
1,133,163,790
116,198,549
862,072,958
160,284,836
368,780,044
1,561,820,920
1,407,692,572
1,480,574,886
473,849,932
380,642,419
167,966,462
466,661,331
1,266,542,359
160,809,301
215,539,845
85,493,351
103,799,041
950,218,662
417,076,793
1,190,550,903
658,771,070
1,388,939,508
1,357,822,101
with this....
<?php
$i=25;
while($i > 0){
$random=rand (0,99999999999999999);
echo number_format($random, 0, '', ',')."\n";
$i--;
}
?>