Created
June 16, 2016 02:03
-
-
Save etoxin/229481c4acb06e816f389d4a200b9843 to your computer and use it in GitHub Desktop.
Make a Unique ID
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 l {Number} Length of random string. | |
* @returns {string} String of random numbers | |
* @constructor | |
*/ | |
function MakeId(l) { | |
var text = "", | |
possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; | |
for (var i = 0; i < l; 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