Random Name Generator
randomname is a Python library that generates random adjective-noun style names, similar to those used by Docker containers or GitHub repositories, to create memorable and easy-to-type unique identifiers. It is currently at version 0.2.1 and has an infrequent release cadence, with the last update in January 2023.
Warnings
- gotcha Repeated calls to `randomname.get_name()` may yield duplicate names, as the library does not inherently guarantee uniqueness across calls. If unique names are required, callers must implement their own tracking and retry logic.
- gotcha The wordlists used by `randomname` are sourced externally and, while intended for general use, may contain words that some users find offensive or inappropriate. The library's README acknowledges this and requests users to report such instances.
Install
-
pip install randomname
Imports
- get_name
import randomname name = randomname.get_name()
Quickstart
import randomname
# Generate a simple adjective-noun name
name1 = randomname.get_name()
print(f"Generated name 1: {name1}")
# Generate a name with specific categories (e.g., from 'weather' adjectives and 'cats' nouns)
name2 = randomname.get_name(adj='weather', noun='cats')
print(f"Generated name 2 (weather-cats): {name2}")
# Generate a name with multiple adjective categories
name3 = randomname.get_name(adj=['colors', 'sound'], noun='ghosts')
print(f"Generated name 3 (colors-sound-ghosts): {name3}")
# Generate a name with a custom format (e.g., verb-adjective-noun)
name4 = randomname.get_name(fmt='v/art a/music_theory n/apex_predators')
print(f"Generated name 4 (custom format): {name4}")