note 36663 added to function.rand
| From: | beantaxi at yahoo dot com | Date: | Fri, 17 Oct 2003 23:58:36 +0000 |
| Subject: | note 36663 added to function.rand | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-58778@lists.php.net to get a copy of this message | ||
irt bkreleger -- while that will work, it would be simpler to just do
function NumGen($length)
{
$limit = pow(10, $length);
return rand(0, $limit);
}
Powers (and logs) of 10 are often useful when dealing with number-of-digit problems . . .
- The Bean
----
Manual Page -- http://www.php.net/manual/en/function.rand.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+36663
Delete -- http://master.php.net/manage/user-notes.php?action=delete+36663&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+36663&report=yes
Search -- http://master.php.net/manage/user-notes.php