Function envpath::random::get_random_value
source · pub fn get_random_value(rand_length: Option<usize>) -> String
Expand description
Generates a random string of alphanumeric characters using the rand
crate.
It takes an optional parameter rand_length
to specify the length of the random string, defaulting to 16 characters if not provided. The function first imports necessary modules from the rand
crate and then uses the current thread to generate a random number generator. It then samples characters from the alphanumeric distribution, maps them into a String, and collects them into a single String to return as output.
Examples
let val = envpath::random::get_random_value(Some(32));
dbg!(&val);