Skip to content

Instantly share code, notes, and snippets.

@coryodaniel
Created December 16, 2017 23:48
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save coryodaniel/d5e8fa15b3d1fe566b3c3f821225936e to your computer and use it in GitHub Desktop.
Save coryodaniel/d5e8fa15b3d1fe566b3c3f821225936e to your computer and use it in GitHub Desktop.
Heroku Style Name Generator in Elixir
defmodule Name do
@adjectives ~w(
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 lingering
bold little morning muddy old red rough still small
sparkling throbbing shy wandering withered wild black
young holy solitary fragrant aged snowy proud floral
restless divine polished ancient purple lively nameless
)
@nouns ~w(
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 hamster
)
def generate(max_id \\ 9999) do
adjective = @adjectives |> Enum.random
noun = @nouns |> Enum.random
id = :rand.uniform(max_id)
[adjective, noun, id] |> Enum.join("-")
end
end
Name.generate()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment