Created
June 26, 2017 09:44
-
-
Save MaanooAk/db1acd0f33a4cf5d5f7b88640351ac9d to your computer and use it in GitHub Desktop.
This file contains 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
function random_password(length) { | |
var characters = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; | |
var password = ""; | |
for (var i = 0; i < length; i++) { | |
var random_float = Math.random(); | |
password += characters.charAt(Math.floor(random_float * characters.length)); | |
} | |
return password; | |
} | |
// minified | |
function random_password(c){for(var a="",b=0;b<c;b++)a+="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".charAt(Math.floor(62*Math.random()));return a}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment