Skip to content

Instantly share code, notes, and snippets.

@ishanjain28
Created December 5, 2016 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ishanjain28/074f50f6f3743d66db7acf3708ef2c45 to your computer and use it in GitHub Desktop.
Save ishanjain28/074f50f6f3743d66db7acf3708ef2c45 to your computer and use it in GitHub Desktop.
function generateRandomString(length) {
var string = "";
var possibleValues = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
for(var i = 0; i < length; i++) {
string += possibleValues.charAt(Math.floor(Math.random() * possibleValues.length));
}
return string;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment