Last active
November 7, 2019 20:27
-
-
Save pxslip/1dad29dd299f0687c441f5a516e5c65b to your computer and use it in GitHub Desktop.
Quick and dirty matching tool
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
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