Created
January 15, 2025 16:10
-
-
Save fforw/f8b2a0dede40b8c24aeec434415551f7 to your computer and use it in GitHub Desktop.
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
| #!/usr/bin/env node | |
| const ANIMAL_DATA = { | |
| "mammals": [ | |
| "Aardvark", | |
| "Alpaca", | |
| "Anteater", | |
| "Antelope", | |
| "Ape", | |
| "Armadillo", | |
| "Baboon", | |
| "Badger", | |
| "Bat", | |
| "Bear", | |
| "Beaver", | |
| "Binturong", | |
| "Bison", | |
| "Boar", | |
| "Buffalo", | |
| "Camel", | |
| "Capybara", | |
| "Caribou", | |
| "Cheetah", | |
| "Chipmunk", | |
| "Chinchilla", | |
| "Chimpanzee", | |
| "Coyote", | |
| "Deer", | |
| "Degu", | |
| "Dingo", | |
| "Dolphin", | |
| "Donkey", | |
| "Dormouse", | |
| "Echidna", | |
| "Elephant", | |
| "Elk", | |
| "Ferret", | |
| "Fox", | |
| "Gazelle", | |
| "Gerbil", | |
| "Giraffe", | |
| "Goat", | |
| "Gopher", | |
| "Gorilla", | |
| "Groundhog", | |
| "Guineapig", | |
| "Hamster", | |
| "Hedgehog", | |
| "Hippopotamus", | |
| "Horse", | |
| "Hyena", | |
| "Ibex", | |
| "Impala", | |
| "Jaguar", | |
| "Jerboa", | |
| "Kangaroo", | |
| "Koala", | |
| "Lemming", | |
| "Lemur", | |
| "Leopard", | |
| "Lion", | |
| "Llama", | |
| "Lynx", | |
| "Manatee", | |
| "Mandrill", | |
| "Marmot", | |
| "Meerkat", | |
| "Mole", | |
| "Mongoose", | |
| "Monkey", | |
| "Moose", | |
| "Mouse", | |
| "Mule", | |
| "Narwhal", | |
| "Nutria", | |
| "Opossum", | |
| "Orangutan", | |
| "Orca", | |
| "Otter", | |
| "Panda", | |
| "Pangolin", | |
| "Panther", | |
| "Pig", | |
| "Platypus", | |
| "Porcupine", | |
| "Porpoise", | |
| "Pouchrat", | |
| "Rabbit", | |
| "Raccoon", | |
| "Ram", | |
| "Rat", | |
| "Red Panda", | |
| "Reindeer", | |
| "Rhinoceros", | |
| "Seal", | |
| "Sheep", | |
| "Shrew", | |
| "Skunk", | |
| "Sloth", | |
| "Springhare", | |
| "Squirrel", | |
| "Tapir", | |
| "Tiger", | |
| "Viscacha", | |
| "Vole", | |
| "Walrus", | |
| "Warthog", | |
| "Weasel", | |
| "Whale", | |
| "Wolf", | |
| "Wolverine", | |
| "Wombat", | |
| "Woodchuck", | |
| "Yak", | |
| "Zebra", | |
| "Zokor" | |
| ], | |
| "birds": [ | |
| "Albatross", | |
| "Cassowary", | |
| "Chicken", | |
| "Crane", | |
| "Crow", | |
| "Dove", | |
| "Duck", | |
| "Eagle", | |
| "Emu", | |
| "Falcon", | |
| "Finch", | |
| "Flamingo", | |
| "Goose", | |
| "Hawk", | |
| "Heron", | |
| "Hummingbird", | |
| "Kingfisher", | |
| "Kookaburra", | |
| "Macaw", | |
| "Magpie", | |
| "Nightingale", | |
| "Ostrich", | |
| "Owl", | |
| "Parrot", | |
| "Peacock", | |
| "Pelican", | |
| "Penguin", | |
| "Pheasant", | |
| "Pigeon", | |
| "Quail", | |
| "Raven", | |
| "Robin", | |
| "Sparrow", | |
| "Stork", | |
| "Swan", | |
| "Toucan", | |
| "Turkey", | |
| "Woodpecker" | |
| ], | |
| "reptiles": [ | |
| "Alligator", | |
| "Anaconda", | |
| "Chameleon", | |
| "Cobra", | |
| "Crocodile", | |
| "Gecko", | |
| "Iguana", | |
| "Komodo", | |
| "Lizard", | |
| "Snake", | |
| "Turtle", | |
| "Viper" | |
| ], | |
| "amphibians": [ | |
| "Axolotl", | |
| "Frog", | |
| "Newt", | |
| "Salamander", | |
| "Toad" | |
| ], | |
| "fish": [ | |
| "Angelfish", | |
| "Barracuda", | |
| "Catfish", | |
| "Clownfish", | |
| "Cod", | |
| "Eel", | |
| "Salmon", | |
| "Seahorse", | |
| "Shark", | |
| "Stingray" | |
| ], | |
| "invertebrates": [ | |
| "Ant", | |
| "Bee", | |
| "Beetle", | |
| "Butterfly", | |
| "Caterpillar", | |
| "Centipede", | |
| "Cockroach", | |
| "Crab", | |
| "Cricket", | |
| "Dragonfly", | |
| "Flea", | |
| "Grasshopper", | |
| "Jellyfish", | |
| "Lobster", | |
| "Mantis", | |
| "Mosquito", | |
| "Octopus", | |
| "Oyster", | |
| "Scorpion", | |
| "Snail", | |
| "Spider", | |
| "Squid", | |
| "Starfish", | |
| "Tarantula", | |
| "Termite", | |
| "Wasp", | |
| "Worm" | |
| ] | |
| } | |
| function merge() | |
| { | |
| let out = [] | |
| for (let name in ANIMAL_DATA) | |
| { | |
| if (ANIMAL_DATA.hasOwnProperty(name)) | |
| { | |
| out = out.concat(ANIMAL_DATA[name]) | |
| } | |
| } | |
| return out | |
| } | |
| function main() | |
| { | |
| const animals = merge() | |
| const indexA = 0|Math.random() * animals.length | |
| let indexB | |
| do | |
| { | |
| indexB = 0|Math.random() * animals.length | |
| } while(indexA === indexB) | |
| console.log(animals[indexA] + " " + animals[indexB]) | |
| } | |
| main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment