Created
April 26, 2020 22:51
-
-
Save kino6052/3e52741d0bbe8e0f6436ff4028755d28 to your computer and use it in GitHub Desktop.
This file contains 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 getRandomNumbers = (length: number) => { | |
const value = Array.from(Math.round(Math.random()*(Math.pow(10, length))).toString()).reverse(); | |
return new Array(length).fill('0').map((v, i) => value[i] || v).reverse().join(''); | |
} | |
const generateId = (amount: number, length: number) => new Array(amount).fill(0).map((a, i, b) => `${i && '-'}${getRandomNumbers(length)}`).join('') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment