Skip to content

Instantly share code, notes, and snippets.

@etoxin
Created June 16, 2016 02:03
Show Gist options
  • Save etoxin/229481c4acb06e816f389d4a200b9843 to your computer and use it in GitHub Desktop.
Save etoxin/229481c4acb06e816f389d4a200b9843 to your computer and use it in GitHub Desktop.
Make a Unique ID
/**
* @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