Update Rust crate rand to 0.9.0 #287
@ -1,12 +1,6 @@
|
||||
use rand::distributions::Alphanumeric;
|
||||
use rand::Rng;
|
||||
use rand::distr::{Alphanumeric, SampleString};
|
||||
|
||||
/// Generate a random string
|
||||
pub fn rand_str(len: usize) -> String {
|
||||
let s: String = rand::thread_rng()
|
||||
.sample_iter(&Alphanumeric)
|
||||
.take(len)
|
||||
.map(char::from)
|
||||
.collect();
|
||||
s
|
||||
Alphanumeric.sample_string(&mut rand::rng(), len)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user