random_word

Crates.iorandom_word
lib.rsrandom_word
version0.4.3
sourcesrc
created_at2022-10-22 05:47:07.342456
updated_at2024-02-02 03:26:54.481684
descriptionEfficient functions for generating random words in many languages.
homepage
repositoryhttps://github.com/MitchellRhysHall/random_word
max_upload_size
id694142
size8,372,759
(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.4.3", 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.
  • Zh - Chinese. Requires enabling "zh" feature.

Generating a random English word

use random_word::Lang;

let word = random_word::gen(Lang::En);

Generating a random English word starting with 'c'

use random_word::Lang;

let word = random_word::gen_starts_with('c', Lang::En);
assert!(word.is_some());

Get all 4 length French words

use random_word::Lang;

let word_list = random_word::all_len(4, Lang::Fr);
Commit count: 56

cargo fmt