Created
December 2, 2025 08:13
-
-
Save rstacruz/d41429b5f2d211c886bea179ff0cd03e 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 bash | |
| # Prints a random name. | |
| # | |
| # Usage: | |
| # echo $(gen-name) | |
| # # oceanwood | |
| # # raincloud | |
| # # mahoganybay | |
| # # scarletfog | |
| one_syllable_words=( | |
| # Colours | |
| black blue bronze brown gold gray green grey jade pink red sky tan white yellow | |
| slate jet lace pine ash buff chrome coal rust sand wine | |
| # Fruits & Vegetables | |
| bean corn date fig grape lime plum bean pear | |
| # Nuts & Spices | |
| clove dill sage salt thyme | |
| # Flowers & Plants | |
| fern moss rose vine leaf | |
| # Birds | |
| crane dove duck hawk goose owl swan swift | |
| # Other Foods | |
| tea | |
| # Planets | |
| earth mars | |
| # Minerals | |
| chalk flint quartz slate talc bone brass clay ore rock steel stone zinc | |
| # Weather | |
| breeze cloud dew fog frost gale hail mist rain sleet snow storm wind | |
| # Nature | |
| bay brook cliff cove creek dale dune field glen hill lake peak pond reef shore spring vale wave wood | |
| # Time/Sky | |
| dawn dusk moon night star sun | |
| # Abstract | |
| bloom drift echo flame flash glow spark tide blaze gleam haze pulse sheen wisp | |
| # Gemstones | |
| pearl | |
| ) | |
| multi_syllable_words=( | |
| # Colours | |
| algae almond amber amethyst aquamarine blackberry cobalt copper coral crimson | |
| cyan emerald garnet indigo magenta maroon mauve navy obsidian onyx opal orange | |
| peridot platinum purple ruby sapphire scarlet silver teal topaz turquoise violet | |
| beige burgundy chartreuse fuchsia khaki mint taupe azure cerulean sepia sienna | |
| vermilion blush cream ecru ivory auburn charcoal chestnut denim ebony espresso | |
| hazel latte linen mahogany midnight neon ocean persimmon rosewood bisque powder | |
| shadow periwinkle | |
| # Fruits & Vegetables | |
| apple apricot avocado banana beetroot blackberry blueberry cantaloupe carrot | |
| cherry chili clementine coconut cranberry currant eggplant grapefruit kabosu | |
| kumquat lemon limequat mandarin mango melon olive onion orange papaya peach | |
| pineapple pomelo potato pumpkin raspberry satsuma strawberry sudachi tangerine | |
| tomato watermelon yuzu | |
| # Nuts & Spices | |
| almond basil cardamom cashew cinnamon cocoa garlic ginger nutmeg oregano paprika | |
| parsley peanut pepper peppermint pistachio rosemary saffron spearmint sugar | |
| vanilla walnut | |
| # Flowers & Plants | |
| azalea bluebell bramble buttercup carnation cilantro clover crocus daffodil | |
| dahlia daisy dandelion eucalyptus freesia gardenia heather hibiscus honeysuckle | |
| hyacinth iris ivy jasmine lavender lichen lilac lily magnolia maple marigold | |
| nettle oleander orchid pansy peony poppy sunflower thistle truffle tulip | |
| # Birds | |
| canary eagle egret emu falcon flamingo heron hummingbird kingfisher kiwi martin | |
| ostrich parrot peacock pelican penguin pigeon robin sparrow stork swallow turkey | |
| woodpecker | |
| # Other Foods | |
| butterscotch caramel chocolate coffee honey honeydew | |
| # Planets & Celestial | |
| jupiter mercury neptune pluto saturn uranus venus io luna solar titan | |
| apollo artemis astro asteroid atlas callisto ceres charon cosmos | |
| eclipse europa galaxy ganymede helios meteor milky orion pegasus | |
| pulsar rigel sirius solaris stellar supernova vega zodiac | |
| # Minerals | |
| alabaster basalt calcite chalcedony feldspar granite gypsum jasper limestone | |
| malachite marble mica sandstone crystal fossil iron metal pewter | |
| # Weather | |
| aurora drizzle lightning rainbow thunder tempest | |
| # Nature | |
| arbor autumn canyon cavern ember forest glacier harbor island meadow mountain | |
| pebble river summer sunset tundra valley willow winter | |
| # Abstract | |
| cascade cinder comet cosmos glimmer horizon lustre mirage nebula nova prism | |
| radiance ripple shimmer solstice twilight zenith aura beacon cadence corona | |
| fusion glitter halo nimbus phantom plasma quasar resonance reverie | |
| sparkle spectrum splendor stardust tremor vigor whisper blessing clarity echo | |
| essence ether flicker fortune fractal glory harmony impulse kinetic lotus | |
| lucid luster mantra matrix momentum mosaic muse mystic orbit omen oracle | |
| paradigm paradox phoenix pixie polaris portal pulse quantum radiant relic | |
| rhythm sacred satori scroll seraph signal siren spiral starlight symphony | |
| synapse tempo threshold transcend vertex vortex wanderer wavelength | |
| # Gemstones | |
| beryl citrine diamond moonstone spinel zircon agate lapis | |
| ) | |
| words=("${one_syllable_words[@]}" "${multi_syllable_words[@]}") | |
| if [[ "$1" == "--count" ]]; then | |
| one_count="${#one_syllable_words[@]}" | |
| multi_count="${#multi_syllable_words[@]}" | |
| total_count="${#words[@]}" | |
| # Single word permutations | |
| single_perms=$total_count | |
| # Two-word permutations (any word + one syllable word) | |
| two_word_perms=$((total_count * one_count)) | |
| total_perms=$((single_perms + two_word_perms)) | |
| # Birthday paradox calculations for two-word mode | |
| # Formula: sqrt(2 * n * ln(1/(1-p))) where p is the probability | |
| collision_01=$(printf "%.0f" "$(echo "scale=2; sqrt(2 * $two_word_perms * 0.01005)" | bc -l)") | |
| collision_50=$(printf "%.0f" "$(echo "scale=2; sqrt(2 * $two_word_perms * 0.69315)" | bc -l)") | |
| collision_99=$(printf "%.0f" "$(echo "scale=2; sqrt(2 * $two_word_perms * 4.60517)" | bc -l)") | |
| echo "Permutations:" | |
| echo " Two-word (-2, default): $two_word_perms" | |
| echo " Single-word (-1): $single_perms" | |
| echo "" | |
| echo "Chances of collision (for -2):" | |
| echo " 1% at ~$collision_01 names" | |
| echo " 50% at ~$collision_50 names" | |
| echo " 99% at ~$collision_99 names" | |
| echo "" | |
| echo "Database:" | |
| echo " One-syllable words: $one_count" | |
| echo " Multi-syllable words: $multi_count" | |
| elif [[ "$1" == "-1" ]]; then | |
| printf '%s\n' "${words[@]}" | shuf -n 1 | |
| else | |
| word=$(printf '%s\n' "${words[@]}" | shuf -n 1) | |
| one_syllable=$(printf '%s\n' "${one_syllable_words[@]}" | shuf -n 1) | |
| printf '%s\n' "${word}${one_syllable}" | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment