NYCPHP Meetup

NYPHP.org

[nycphp-talk] generate random unique 8-digit number

Tim Gales tgales at tgaconnect.com
Tue Mar 10 19:23:56 EDT 2009


Chris Snyder wrote:
>
> Doing something like $random = $microtime . "_" . rand( 0, 256 );
> gives you non-repeating pseudo-randomness. 
md5(uniqid(rand(), true))
// as suggested in the manual

is harder to guess -- but now you're talkin' 32 chars.
(as usual it depends on what you're tryin' to do)

-- 
T. Gales & Associates  
'Helping People Connect with Technology' 
http://www.tgaconnect.com 




More information about the talk mailing list