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

#185 in Algorithms

Download history 4482/week @ 2024-07-30 4396/week @ 2024-08-06 5731/week @ 2024-08-13 5625/week @ 2024-08-20 5127/week @ 2024-08-27 5986/week @ 2024-09-03 5699/week @ 2024-09-10 5266/week @ 2024-09-17 6031/week @ 2024-09-24 6376/week @ 2024-10-01 14929/week @ 2024-10-08 21261/week @ 2024-10-15 12059/week @ 2024-10-22 10447/week @ 2024-10-29 9475/week @ 2024-11-05 8327/week @ 2024-11-12

44,379 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