| Crates.io | goofy-animals |
| lib.rs | goofy-animals |
| version | 0.0.2 |
| created_at | 2025-02-26 05:42:08.33412+00 |
| updated_at | 2025-02-28 15:41:49.792498+00 |
| description | Generate a name in adjective-adjective-animal form |
| homepage | |
| repository | https://github.com/ZentriaMC/goofy-animals.git |
| max_upload_size | |
| id | 1570048 |
| size | 65,871 |
A lightweight Rust library for generating fun, random names in the format adjective-adjective-animal.
Goofy Animals generates names like:
healthy-frivolous-doveglorious-meager-polar-bearthankful-elastic-clownfishPerfect for:
Add this to your Cargo.toml:
[dependencies]
goofy-animals = "0.0.1"
use goofy_animals::generate_name;
use rand::SeedableRng;
use rand_chacha::ChaCha20Rng;
fn main() {
// Use a random seed
let mut rng = ChaCha20Rng::from_entropy();
// Generate a random name
let name = generate_name(&mut rng);
println!("{}", name); // e.g., "vigilant-troubled-firefly"
}
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, "healthy-frivolous-dove");
}
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_entropy();
let (adj1, adj2, animal) = generate_name_parts(&mut rng);
println!("First adjective: {}", adj1);
println!("Second adjective: {}", adj2);
println!("Animal: {}", animal);
}
alloc (default): Enables the generate_name function that returns a Stringtracing: Adds tracing instrumentation for debuggingexamples: Enables building the example binary goofy-animalWith 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-porcupine
Or you can install the CLI tool via cargo install:
cargo install --features=examples goofy-animals
This project uses a Nix flake for development environment setup. If you have Nix installed:
# Enter the development shell
nix develop
Or with direnv:
direnv allow
This project is licensed under the Mozilla Public License 2.0 - see the LICENSE file for details.
The library includes:
All words are in English.