Skip to content

Instantly share code, notes, and snippets.

@akbarjondev
Created June 19, 2021 12:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save akbarjondev/9742239fdf0ed3e56246988c9b990577 to your computer and use it in GitHub Desktop.
Save akbarjondev/9742239fdf0ed3e56246988c9b990577 to your computer and use it in GitHub Desktop.
Javascript generate fixed length random number function
const getFixedLengthRandomnumber = fixed_digit => (String(Math.round(Math.random() * (10**fixed_digit))).padEnd(fixed_digit, '0') - 0)
getFixedLengthRandomnumber(6)
@muocod
Copy link

muocod commented Jun 21, 2021

LIKE

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