Created
August 28, 2019 08:03
-
-
Save victorocna/e3202e2f5d6b6642c80255d74280e696 to your computer and use it in GitHub Desktop.
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
/** | |
* Generates a numeric random key with fixed length | |
* @param {int} length | |
*/ | |
const randomKey = (length) => { | |
return Math.floor(Math.pow(10, length) + Math.random() * 9 * Math.pow(10, length)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
inspired by https://stackoverflow.com/a/21816636