Expand description
§Goofy Animals
A lightweight Rust library for generating fun, random names in the format adjective-adjective-animal.
§Overview
Goofy Animals generates names like:
healthy-frivolous-doveglorious-meager-polar-bearthankful-elastic-clownfish
Perfect for:
- Container & machine names
- Test fixtures
- Temporary resources
- Development environments
- Anywhere you need a friendly, memorable identifier
§Features
- No-std compatible - Core functionality works without the standard library
- Lightweight - Uses compile-time string parsing for small binary size
- Fast - Efficient name generation with minimal overhead
- Configurable - Optional features for different use cases
- Deterministic - Support for seeded RNG for repeatable results
§Installation
Add this to your Cargo.toml:
[dependencies]
goofy-animals = "0.1.0"§Usage
§Basic example
use goofy_animals::generate_name;
use rand::SeedableRng;
use rand_chacha::ChaCha20Rng;
fn main() {
// Use a random seed
let mut rng = ChaCha20Rng::from_os_rng();
// Generate a random name
let name = generate_name(&mut rng);
println!("{}", name); // e.g., "vigilant-troubled-firefly"
}§Deterministic names
use goofy_animals::generate_name;
use rand::SeedableRng;
use rand_chacha::ChaCha20Rng;
fn main() {
// Use a fixed seed for deterministic output
let mut rng = ChaCha20Rng::seed_from_u64(0x1337);
let name = generate_name(&mut rng);
assert_eq!(name, "dismal-outlying-moth");
}§Just the parts
If you want the individual name components:
use rand::SeedableRng;
use rand_chacha::ChaCha20Rng;
use goofy_animals::generate_name_parts;
fn main() {
let mut rng = ChaCha20Rng::from_os_rng();
let (adj1, adj2, animal) = generate_name_parts(&mut rng);
println!("First adjective: {}", adj1);
println!("Second adjective: {}", adj2);
println!("Animal: {}", animal);
}§Feature flags
alloc(default): Enables thegenerate_namefunction that returns aStringstd: Used only for testingtracing: Adds tracing instrumentation for debuggingexamples: Enables building the example binarygoofy-animal
§Command line tool
With the examples feature enabled, you can build and run the simple CLI tool:
# Build with examples feature
cargo build --features=examples
# Run the binary
./target/debug/goofy-animal
# Output: handsome-modest-porcupineOr you can install the CLI tool via cargo install:
cargo install --features=examples goofy-animals§Development
This project uses a Nix flake for development environment setup. If you have Nix installed:
# Enter the development shell
nix developOr with direnv:
direnv allow§License
This project is licensed under the Mozilla Public License 2.0 - see the LICENSE file for details.
§Data
The library includes:
- 355 animal names
- 1300 adjectives
All words are in English.
Structs§
- Goofy
Animals - A struct that manages lists of adjectives and animals for generating goofy names.
Constants§
- DEFAULT_
GOOFY_ ANIMALS - A default instance of
GoofyAnimalsinitialized with the built-in English word lists.
Functions§
- generate_
name alloc - Generates a complete goofy name as a string using the default word lists.
- generate_
name_ parts - Generates the individual parts of a goofy name using the default word lists.