Skip to content

Instantly share code, notes, and snippets.

@riebschlager
Created October 11, 2017 14:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save riebschlager/0fc395cef584857248ffd56ce0c477e0 to your computer and use it in GitHub Desktop.
Save riebschlager/0fc395cef584857248ffd56ce0c477e0 to your computer and use it in GitHub Desktop.
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