Created
October 11, 2017 14:29
-
-
Save riebschlager/0fc395cef584857248ffd56ce0c477e0 to your computer and use it in GitHub Desktop.
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
let ids = []; | |
const fs = require('fs'); | |
if(!String.prototype.padStart) { | |
String.prototype.padStart = function padStart(targetLength, padString) { | |
targetLength = targetLength >> 0; | |
padString = String(padString || ' '); | |
if(this.length > targetLength) { | |
return String(this); | |
} | |
else { | |
targetLength = targetLength - this.length; | |
if(targetLength > padString.length) { | |
padString += padString.repeat(targetLength / padString.length); | |
} | |
return padString.slice(0, targetLength) + String(this); | |
} | |
}; | |
} | |
while(ids.length < 250) { | |
let rnd = (Math.floor(Math.random() * 10000) + '').padStart(4, '0'); | |
if(ids.indexOf(rnd) === -1) ids.push(rnd); | |
} | |
fs.writeFile('list.txt', ids.join('\n')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment