Skip to content

Instantly share code, notes, and snippets.

@ff6347
Created January 26, 2021 08:16
Show Gist options
  • Save ff6347/60757ec2e737460407ff2c1626c0340c to your computer and use it in GitHub Desktop.
Save ff6347/60757ec2e737460407ff2c1626c0340c to your computer and use it in GitHub Desktop.
select random pairs from list
//@ts-check
function shuffle(array) {
array.sort(() => Math.random() - 0.5);
return array;
}
function main() {
let names = [
"Babbit and Catstello",
"Barnyard Dawg",
"Beans",
"Blacque Jacque Shellacque",
"Bosko",
"Buddy",
"Bugs Bunny",
"Honey Bunny",
"Lola Bunny",
"Beaky Buzzard",
"Claude Cat",
"Charlie Dog",
"Clyde Bunny",
"Colonel Shuffle",
"Conrad the Cat",
"Cool Cat",
"Daffy Duck",
"Development of Bugs Bunny",
"Egghead Jr.",
"Elmer Fudd",
"Foghorn Leghorn",
"Foxy",
"Michigan J. Frog",
"Gabby Goat",
"Speedy Gonzales",
"Goofy Gophers",
"Goopy Geer",
"Gossamer",
"Granny",
"Henery Hawk",
"Hector the Bulldog",
"Hippety Hopper",
"Hubie and Bertie",
"Hugo the Abominable Snowman",
"Inki",
"List of Looney Tunes Cartoons characters",
"Marc Antony and Pussyfoot",
"Marvin the Martian",
"Melissa Duck",
"Merlin the Magic Mouse",
"Miss Prissy",
"Nasty Canasta",
"Penelope Pussycat",
"Pepé Le Pew",
"Pete Puma",
"Petunia Pig",
"Porky Pig",
"Piggy",
"Playboy Penguin",
"Private Snafu",
"Quick Brown Fox and Rapid Rabbit",
"Ralph Wolf and Sam Sheepdog",
"Rocky and Mugsy",
"Slowpoke Rodriguez",
"Sniffles",
"Spike the Bulldog and Chester the Terrier",
"Sylvester Jr.",
"Sylvester the Cat",
"Tasmanian Devil",
"The Three Bears",
"Cecil Turtle",
"Tweety",
"Wile E. Coyote and the Road Runner",
"Willoughby",
"Witch Hazel",
"Yosemite Sam",
];
names = shuffle(names);
const result = [];
for (let i = 0; i < names.length; i += 2) {
if (i + 1 < names.length) {
result.push([names[i], names[i + 1]]);
} else {
result.push([names[i], null]);
}
}
console.log(result);
}
main();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment