random_word

Crates.iorandom_word
lib.rsrandom_word
version0.5.2
created_at2022-10-22 05:47:07.342456+00
updated_at2025-08-26 11:22:28.434695+00
descriptionEfficient functions for generating random words in many languages.
homepage
repositoryhttps://github.com/MitchellRhysHall/random_word
max_upload_size
id694142
size9,331,635
(MitchellRhysHall)

documentation

README

random_word

The random_word crate provides an efficient way to generate random words. Included words can be filtered by length or first character.

Usage

You MUST enable a crate language feature. Crate language features are mandatory to reduce binary size. Example for English in Cargo.toml:

[dependencies]
random_word = { version = "0.5.2", features = ["en"] }

Supported Languages

  • De - German. Requires enabling "de" feature.
  • En - English. Requires enabling "en" feature.
  • Es - Spanish. Requires enabling "es" feature.
  • Fr - French. Requires enabling "fr" feature.
  • Ja - Japanese. Requires enabling "ja" feature.
  • Ru - Russian. Requires enabling "ru" feature.
  • Zh - Chinese. Requires enabling "zh" feature.

Generating a random English word

use random_word::Lang;

fn main() {
    let word = random_word::get(Lang::En);
}

Generating a random English word starting with 'c'

use random_word::Lang;

fn main() {
    let word = random_word::get_starts_with('c', Lang::En);
    assert!(word.is_some());
}

Get all 4 length French words

use random_word::Lang;

fn main() {
    let word_list = random_word::all_len(4, Lang::Fr);
    assert!(!word_list.is_empty());
}
Commit count: 65

cargo fmt