names::three

Function rand_with

Source
pub fn rand_with(rng: &mut impl Rng) -> &'static str
Expand description

Selects a random name out of *all* available three-letter names (including UPPERCASE, Usualcase and lowercase) using a provided Random Number Generator (RNG).

Note that this dependent on which features are given. For example, if only the three-uppercase-feature is given, this will only return uppercase names.

§Arguments

  • rng: The random number generator (as an [Rng]) to use.

§Returns

A &'static str that refers to a random constant in this crate.

§Example

use names::three::rand_with;
use rand::thread_rng;

// Could print any of the `AMY`, `Bob`, `cho`, ... names!
println!("{}", rand_with(&mut thread_rng()));