Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.