MCPcopy Create free account
hub / github.com/douchuan/algorithm / shuffle

Function shuffle

src/common/util.rs:4–7  ·  view source on GitHub ↗
(data: &mut [T])

Source from the content-addressed store, hash-verified

2use rand::prelude::SliceRandom;
3
4pub fn shuffle<T>(data: &mut [T]) {
5 let mut rng = rand::thread_rng();
6 data.shuffle(&mut rng);
7}
8
9// n, item length
10// n = 1, vec!["a", "b", ... "z"]

Callers 4

gen_random_dataFunction · 0.85
sortMethod · 0.85
insert_sort_dthFunction · 0.85
gen_vec_dataFunction · 0.85

Calls

no outgoing calls

Tested by 2

insert_sort_dthFunction · 0.68
gen_vec_dataFunction · 0.68