/ Published in: PHP
URL: http://www.sitepoint.com/blogs/2008/11/13/how-to-create-friendlier-random-passwords/
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
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; }
Comments
Subscribe to comments
You need to login to post a comment.

in a way that's similar to a password generator I wrote a while back
http://mmdeveloper.selfip.com/Random+Password+Generator-p76.html
class passwordGenerator { var $input = NULL; var $charset = NULL;
}