Skip to main content

kellnr_common/
util.rs

1use std::iter;
2
3use rand::distr::Alphanumeric;
4use rand::{Rng, rng};
5
6pub fn generate_rand_string(length: usize) -> String {
7    let mut rng = rng();
8    iter::repeat(())
9        .map(|()| rng.sample(Alphanumeric))
10        .map(char::from)
11        .take(length)
12        .collect::<String>()
13}