@@ -30,7 +30,7 @@ pub use self::{
|
|||||||
json::{deserialize_from_str, to_canonical_object},
|
json::{deserialize_from_str, to_canonical_object},
|
||||||
math::clamp,
|
math::clamp,
|
||||||
mutex_map::{Guard as MutexMapGuard, MutexMap},
|
mutex_map::{Guard as MutexMapGuard, MutexMap},
|
||||||
rand::string as random_string,
|
rand::{shuffle, string as random_string},
|
||||||
stream::{IterStream, ReadyExt, Tools as StreamTools, TryReadyExt},
|
stream::{IterStream, ReadyExt, Tools as StreamTools, TryReadyExt},
|
||||||
string::{str_from_bytes, string_from_bytes},
|
string::{str_from_bytes, string_from_bytes},
|
||||||
sys::available_parallelism,
|
sys::available_parallelism,
|
||||||
|
|||||||
@@ -4,7 +4,12 @@ use std::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
use arrayvec::ArrayString;
|
use arrayvec::ArrayString;
|
||||||
use rand::{thread_rng, Rng};
|
use rand::{seq::SliceRandom, thread_rng, Rng};
|
||||||
|
|
||||||
|
pub fn shuffle<T>(vec: &mut [T]) {
|
||||||
|
let mut rng = thread_rng();
|
||||||
|
vec.shuffle(&mut rng);
|
||||||
|
}
|
||||||
|
|
||||||
pub fn string(length: usize) -> String {
|
pub fn string(length: usize) -> String {
|
||||||
thread_rng()
|
thread_rng()
|
||||||
|
|||||||
Reference in New Issue
Block a user