Created
January 20, 2016 07:01
-
-
Save etoxin/cbc4bbf60c27ddfd750b to your computer and use it in GitHub Desktop.
Create a string that s random
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
/** | |
* @param lng {Number} | |
* @returns {string} | |
* @constructor | |
*/ | |
function MakeId(lng) { | |
var text = ""; | |
var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; | |
for (var i = 0; i < lng; i++) | |
text += possible.charAt(Math.floor(Math.random() * possible.length)); | |
return text; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment