Skip to content

Instantly share code, notes, and snippets.

@dbrockman
Created June 6, 2013 18:26
Show Gist options
  • Select an option

  • Save dbrockman/5723744 to your computer and use it in GitHub Desktop.

Select an option

Save dbrockman/5723744 to your computer and use it in GitHub Desktop.
Function that returns a random string of specified length.
function randomString(length) {
var s = ((performance.now() % 1) + Math.random()).toString(35);
return s.substr(-Math.max(0, Math.min(length, s.length - 2)));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment