note 63855 deleted from function.rand by bjori
| From: | bjori@php.net | Date: | Sun, 02 Apr 2006 14:41:31 +0000 |
| Subject: | note 63855 deleted from function.rand by bjori | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-107165@lists.php.net to get a copy of this message | ||
Note Submitter: JimmyNighthawk
Reason: bad code
----
Here is a code i do use to generate very long random numbers,..
... regarding the max_size of an integer is limited.
You either can decide the number is allowed to start w/ a null
as true or false for not.
<?php
function SuperRandomNumber($length,$nullstart=false)
{$nr='';
for($i=0;$i<$length;$i++)
{$nr.=rand(($i==0&&$nullstart?0:1),9);
}
return $nr;
}
echo SuperRandomNumber(100);
?>