Created
September 9, 2019 13:00
-
-
Save capJavert/936042915fdc6ad07b526b611d65208f to your computer and use it in GitHub Desktop.
Generate random string of specified length.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const randomString = (length = 16) => { | |
let string = '' | |
for (let i = 0; i < length; i += 1) { | |
const random = (Math.random() * 16) | 0 // eslint-disable-line | |
string += random.toString(16) | |
} | |
return string | |
} | |
export default randomString |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment