Skip to content

Instantly share code, notes, and snippets.

@victorocna
Created August 28, 2019 08:03
Show Gist options
  • Save victorocna/e3202e2f5d6b6642c80255d74280e696 to your computer and use it in GitHub Desktop.
Save victorocna/e3202e2f5d6b6642c80255d74280e696 to your computer and use it in GitHub Desktop.
/**
* 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))
}
@victorocna
Copy link
Author

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