/ Published in: PHP
Now, it’s true that if we use this function to generate passwords, the passwords created will be less secure — this function can only create 285 (17 million) different five-character passwords whereas if I had included the missing characters this number would’ve been 365 (60 million). That’s a trade-off you’ll have to accept in return for fewer frustrated users having difficulty logging on to your site, which can be mitigated by forcing users to change their generated password to something chosen by them.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function GenerateRandomString($length) { 'a', 'c', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'm', 'p', 'q', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'); $randomString = ""; $randomString .= $characters[$randomCharacterIndex]; } return $randomString; }
URL: http://www.sitepoint.com/blogs/2008/11/13/how-to-create-friendlier-random-passwords/