anonymous_name_generator v0.1.0 AnonymousNameGenerator View Source

This library will create Heroku-like names

It can create random names like “pungent-slime”

If you need more variation, you can generate names likes “pungent-slime-1234”

It can also create consistent names if you pass in integers

Example. This will always return "interesting-emu"

  user = %User{id: 341, timestamp: 1530244444}
  generate_consistent(user.id, user.timestamp)
  => "interesting-emu"
  generate_consistent(user.id, user.timestamp)
  => "interesting-emu"

Link to this section Summary

Functions

This will always return the same result if the same params are passed

This will create a new unique name on each call. By default, the number of possibilities are: number of adjectives(299) multiplied by the number of nouns(464) = 138736

Link to this section Functions

Link to this function generate_consistent(a, b, num_possibilities \\ nil) View Source

This will always return the same result if the same params are passed.

This can be used for always giving the same name to a user. For example generate_consistent(user.id, user.inserted_at_unix_timestamp))

  generate_consistent(1, 2)
  => "damaged-quill"
  generate_consistent(1, 2)
  => "damaged-quill"
  generate_consistent(10, 11, 2_000_000)
  => "hidden-ghost-18"
  generate_consistent(10, 11, 2_000_000)
  => "hidden-ghost-18"
Link to this function generate_random(num_possibilities \\ nil) View Source

This will create a new unique name on each call. By default, the number of possibilities are: number of adjectives(299) multiplied by the number of nouns(464) = 138736

Passing a param will add a number if more possibilities are needed.

  generate_random()
  => "cheery-pond"
  generate_random(1_000_000)
  => "spicy-snowflake-5"