Created
October 14, 2021 14:33
-
-
Save icetee/56f0c343e3c88f9323d22ea1f856bccc to your computer and use it in GitHub Desktop.
Get random serial numbers
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
let count = 10100; | |
let prefix = "KGY" | |
let keys = []; | |
let getRandomNumber = () => ("0000" + Math.round(Math.random() * 10000)).slice(-4) | |
do { | |
let randomKey = prefix + "-" + getRandomNumber() + "-" + getRandomNumber(); | |
if (keys.indexOf(randomKey) === -1) { | |
keys.push(randomKey) | |
} | |
} while (keys.length < count); | |
copy(keys.join("\n")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment