Fix rand 0.9.0 breaking changes
This commit is contained in:
		@@ -1,11 +1,6 @@
 | 
			
		||||
use rand::distributions::Alphanumeric;
 | 
			
		||||
use rand::Rng;
 | 
			
		||||
use rand::distr::{Alphanumeric, SampleString};
 | 
			
		||||
 | 
			
		||||
/// Generate a random string of a given size
 | 
			
		||||
pub fn rand_str(len: usize) -> String {
 | 
			
		||||
    rand::thread_rng()
 | 
			
		||||
        .sample_iter(&Alphanumeric)
 | 
			
		||||
        .take(len)
 | 
			
		||||
        .map(char::from)
 | 
			
		||||
        .collect()
 | 
			
		||||
    Alphanumeric.sample_string(&mut rand::rng(), len)
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user