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
44,379 downloads per month
Used in 18 crates
(15 directly)
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