note 36865 deleted from function.rand by aidan
| From: | aidan@php.net | Date: | Sat, 11 Sep 2004 07:42:26 +0000 |
| Subject: | note 36865 deleted from function.rand by aidan | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-76449@lists.php.net to get a copy of this message | ||
Note Submitter: Soletan
----
Well, previous example of NumGen is no real alternative to the first from bkreleger, since it still
may return "0" even if 10 digits are requested, for example.
Anyhow the first might be shortened this way:
function NumGen( $length ) {
for ( $i = 0; $i < $length; $i++ )
$randnum .= rand( 0, 9 );
return $randnum;
}
Quite small.