names

Function rand_with

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

Selects a random name out of *all* available 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-feature is given, this will only return three-letter 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::rand_with;
use rand::thread_rng;

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