Skip to content

Instantly share code, notes, and snippets.

@laziel
Created March 14, 2023 12:06
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 laziel/ff8f61693f38d37bd0a41b5eab5dde72 to your computer and use it in GitHub Desktop.
Save laziel/ff8f61693f38d37bd0a41b5eab5dde72 to your computer and use it in GitHub Desktop.
Generate random string in given length
const genRandomStr = (length = 16) {
let t = '';
while (t.length < 16) {
t = t + Math.random().toString(36).substr(2);
}
return t.substr(0, length);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment