note 102318 added to function.mt-rand
| From: | thegreatall at gmail dot com | Date: | Tue, 08 Feb 2011 15:54:02 +0000 |
| Subject: | note 102318 added to function.mt-rand | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-176780@lists.php.net to get a copy of this message | ||
Correction to what I said before about the fast random number/serial. This will result in an
EXTREMELY fast random string using the following characters:
"0123456789abcdefghijklmnopqrstuvwxyz"
you can use:
<?php
base_convert(mt_rand(0x1D39D3E06400000, 0x41C21CB8E0FFFFFF), 10, 36);
?>
This will be a random number/string always 12 characters. This will only work on 64 bit systems.
This will result in a random number/string between: 100000000000 to zzzzzzzzzzzz If you are using a
32 bit system you will need to use:
<?php
base_convert(mt_rand(0x1679616, 0x39AA3FF, 10, 36);
?>
This will result in a 5 character random number/string, between: 10000 to zzzzz
----
Server IP: 69.147.83.197
Probable Submitter: 12.71.233.34
----
Manual Page -- http://www.php.net/manual/en/function.mt-rand.php
Edit -- https://master.php.net/note/edit/102318
Del: integrated -- https://master.php.net/note/delete/102318/integrated
Del: useless -- https://master.php.net/note/delete/102318/useless
Del: bad code -- https://master.php.net/note/delete/102318/bad+code
Del: spam -- https://master.php.net/note/delete/102318/spam
Del: non-english -- https://master.php.net/note/delete/102318/non-english
Del: in docs -- https://master.php.net/note/delete/102318/in+docs
Del: other reasons-- https://master.php.net/note/delete/102318
Reject -- https://master.php.net/note/reject/102318
Search -- https://master.php.net/manage/user-notes.php