Created
June 19, 2021 12:56
-
-
Save akbarjondev/9742239fdf0ed3e56246988c9b990577 to your computer and use it in GitHub Desktop.
Javascript generate fixed length random number function
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
const getFixedLengthRandomnumber = fixed_digit => (String(Math.round(Math.random() * (10**fixed_digit))).padEnd(fixed_digit, '0') - 0) | |
getFixedLengthRandomnumber(6) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
LIKE