Fix rand 0.9.0 breaking changes
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing

This commit is contained in:
Pierre HUBERT 2025-02-03 21:03:06 +01:00
parent cf31ab6ecd
commit 70ca59d96f

View File

@ -1,12 +1,6 @@
use rand::distributions::Alphanumeric; use rand::distr::{Alphanumeric, SampleString};
use rand::Rng;
/// Generate a random string /// Generate a random string
pub fn rand_str(len: usize) -> String { pub fn rand_str(len: usize) -> String {
let s: String = rand::thread_rng() Alphanumeric.sample_string(&mut rand::rng(), len)
.sample_iter(&Alphanumeric)
.take(len)
.map(char::from)
.collect();
s
} }