Skip to content

Instantly share code, notes, and snippets.

@pxslip
Last active November 7, 2019 20:27
Show Gist options
  • Save pxslip/1dad29dd299f0687c441f5a516e5c65b to your computer and use it in GitHub Desktop.
Save pxslip/1dad29dd299f0687c441f5a516e5c65b to your computer and use it in GitHub Desktop.
Quick and dirty matching tool
const args = process.argv.slice(2);
const names = args[0].split(',');
const usedIndices = [];
names.forEach(name => {
let rand = Math.floor(Math.random() * names.length);
let other = names[rand];
while (other === name || usedIndices.includes(rand)) {
rand = Math.floor(Math.random() * names.length);
other = names[rand];
}
usedIndices.push(rand);
console.log(`${name} has ${other}`);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment