Created
February 13, 2014 03:35
-
-
Save cmoore4/8969318 to your computer and use it in GitHub Desktop.
JS Password Generator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use: var myPassword = makePWD(10); | |
function makePWD(len){ | |
// Characters to include in the generator | |
var vars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!@#$%^&*()-_+=~<>;"; | |
var pwd = ''; | |
for(var i=0; i < len; i++){ | |
var idx = Math.floor(Math.random()*vars.length-1); | |
pwd += vars.substring(idx,idx+1); | |
} | |
return pwd; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment