Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
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
2
use rand::prelude::SliceRandom;
3
4
pub 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_data
Function · 0.85
sort
Method · 0.85
insert_sort_dth
Function · 0.85
gen_vec_data
Function · 0.85
Calls
no outgoing calls
Tested by
2
insert_sort_dth
Function · 0.68
gen_vec_data
Function · 0.68