Created
November 9, 2017 16:31
-
-
Save justincorrigible/a11f35e818c5a77a859657d47bae7265 to your computer and use it in GitHub Desktop.
Generate a string filled with random characters. Takes a custom length and char options.
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 generateRandomString = (length = 6, chars = '0123456789abcdefghijklmnOPQRSTUVWXYZ') => | |
Array.apply(null, {length}).reduce(hash => hash.concat(chars[Math.round(Math.random() * (chars.length - 1))]), ''); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment