Skip to content

Instantly share code, notes, and snippets.

@stuartbain
Created February 7, 2017 01:31
Show Gist options
  • Save stuartbain/30f83d9882ba8be3fbe1f5ebb700d6d0 to your computer and use it in GitHub Desktop.
Save stuartbain/30f83d9882ba8be3fbe1f5ebb700d6d0 to your computer and use it in GitHub Desktop.
Create Heroku style random names
defmodule HerokuName do
def generate() do
adjectives = [
"autumn", "hidden", "bitter", "misty", "silent", "empty", "dry", "dark",
"summer", "icy", "delicate", "quiet", "white", "cool", "spring", "winter",
"patient", "twilight", "dawn", "crimson", "wispy", "weathered", "blue",
"billowing", "broken", "cold", "damp", "falling", "frosty", "green",
"long", "late", "bold", "little", "morning", "muddy",
"red", "rough", "still", "small", "sparkling", "shy",
"wandering", "withered", "wild", "black", "young", "holy", "solitary",
"fragrant", "aged", "snowy", "proud", "floral", "restless",
"polished", "purple", "lively", "nameless"
]
nouns = [
"waterfall", "river", "breeze", "moon", "rain", "wind", "sea", "morning",
"snow", "lake", "sunset", "pine", "shadow", "leaf", "dawn", "glitter",
"forest", "hill", "cloud", "meadow", "sun", "glade", "bird", "brook",
"butterfly", "bush", "dew", "dust", "field", "fire", "flower", "firefly",
"feather", "grass", "haze", "mountain", "night", "pond", "darkness",
"snowflake", "silence", "sound", "sky", "shape", "surf", "thunder",
"violet", "water", "wildflower", "wave", "water", "resonance", "sun",
"wood", "dream", "cherry", "tree", "fog", "frost", "voice", "paper",
"frog", "smoke", "star"
]
"#{Enum.random(adjectives)}-#{Enum.random(nouns)}-#{Enum.random(1_000..9_999)}"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment