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

#164 in Algorithms

Download history 2344/week @ 2024-07-04 3136/week @ 2024-07-11 3679/week @ 2024-07-18 3995/week @ 2024-07-25 4834/week @ 2024-08-01 4580/week @ 2024-08-08 5814/week @ 2024-08-15 5510/week @ 2024-08-22 5176/week @ 2024-08-29 6212/week @ 2024-09-05 5479/week @ 2024-09-12 5493/week @ 2024-09-19 6467/week @ 2024-09-26 7422/week @ 2024-10-03 16411/week @ 2024-10-10 21466/week @ 2024-10-17

52,925 downloads per month
Used in 17 crates (14 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