Created
October 27, 2017 22:04
-
-
Save belchior/f373af162842db7ca088cfd479cddf93 to your computer and use it in GitHub Desktop.
generate a random hash between 1 and 10 chars
This file contains hidden or 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
function randomHash(numberOfChars) { | |
numberOfChars = Math.min(Number(numberOfChars) || 1, 10); | |
return Math.random().toString(36).slice(-numberOfChars); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The chars used to compose the hash are: abcdefghijklmnopqrstwyz0123456789
Usage: