Skip to content

Instantly share code, notes, and snippets.

@luislobo14rap
Created September 11, 2018 23:46
Show Gist options
  • Save luislobo14rap/a1f63c4a7bad7e4c2fd05f0be89805fd to your computer and use it in GitHub Desktop.
Save luislobo14rap/a1f63c4a7bad7e4c2fd05f0be89805fd to your computer and use it in GitHub Desktop.
// randomString.js v1
function randomString(length = 10, characters = 'abcdefghijklmnopqrstuvwxyz') {
let result = '';
for (let i = 0; i < length; i++) {
result += characters[Math.floor(Math.random() * characters.length)];
};
return result;
};
// randomString.min.js v1
function randomString(a=10,b='abcdefghijklmnopqrstuvwxyz'){let c='';for(let d=0;d<a;d++)c+=b[Math.floor(Math.random()*b.length)];return c}
@luislobo14rap
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment