note 101075 deleted from function.mt-rand by danbrown

[email protected]
Newsgroups php.notes
Message-ID <[email protected]>
Note Submitter: thegreatall at gmail dot com 

----

If you want to generate an EXTREMELY FAST random serial using '0123456789abcdefghijklmnopqrstuvwxyz' you can use:
<?php
base_convert(mt_rand(0, 0x38E38E38E38E38E), 10, 36);
?>

You may need to change the 0x38E38E38E38E38E to whatever your (PHP_INT_MAX / 36) is. that number is for 64 bit machines, 32 bit machines will be: 0x38E38E3. on on 64 bit machines it gives roughly between a 1 to 12 character number. on a 32 bit machine it will return roughly 1 to 5 characters.

If you do some simple math you can get it to always return a certain number of characters.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.