Skip to content

Instantly share code, notes, and snippets.

@derjp
Last active December 24, 2019 14:37
Show Gist options
  • Save derjp/29e3258dd920427aaa80d18251cac97b to your computer and use it in GitHub Desktop.
Save derjp/29e3258dd920427aaa80d18251cac97b to your computer and use it in GitHub Desktop.
const START_STRING = 'nwlIw6fcI6qf1pmTPuZV1c5SdaIEY2P2Jf9Hf50';
const CHARS_TO_GENERATE = 9;
const CODES_TO_GENERATE = 100;
const POSSIBLE_CHARS = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890';
const TEXTAREA = document.createElement('textarea');
TEXTAREA.cols = 150;
TEXTAREA.rows = 100;
document.body.appendChild(TEXTAREA);
for (let i = 0; i < CODES_TO_GENERATE; i++) {
let code = START_STRING;
for (let i = 0; i < CHARS_TO_GENERATE; i++) {
code += POSSIBLE_CHARS.charAt(Math.floor(Math.random() * POSSIBLE_CHARS.length));
}
TEXTAREA.value += (code + '\n');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment