14 releases

0.4.3 Feb 2, 2024
0.4.2 Jan 16, 2024
0.4.1 Jul 2, 2023
0.3.1 May 28, 2023
0.1.1 Oct 22, 2022

#208 in Algorithms

Download history 5638/week @ 2024-08-26 5419/week @ 2024-09-02 5998/week @ 2024-09-09 5142/week @ 2024-09-16 5632/week @ 2024-09-23 6744/week @ 2024-09-30 13442/week @ 2024-10-07 19527/week @ 2024-10-14 14092/week @ 2024-10-21 10938/week @ 2024-10-28 10116/week @ 2024-11-04 7875/week @ 2024-11-11 10158/week @ 2024-11-18 4703/week @ 2024-11-25 8245/week @ 2024-12-02 239624/week @ 2024-12-09

263,038 downloads per month
Used in 18 crates (15 directly)

MIT license

8MB
151 lines

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);

Dependencies

~8MB
~285K SLoC