We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ee00679 commit d061ab6Copy full SHA for d061ab6
crates/rust-analyzer/src/cli/analysis_stats.rs
@@ -309,8 +309,13 @@ pub fn analysis_stats(
309
}
310
311
fn shuffle<T>(rng: &mut Rand32, slice: &mut [T]) {
312
- for i in (1..slice.len()).rev() {
313
- let idx = rng.rand_range(0..i as u32) as usize;
314
- slice.swap(idx, i)
+ for i in 0..slice.len() {
+ randomize_first(rng, &mut slice[i..]);
+ }
315
+
316
+ fn randomize_first<T>(rng: &mut Rand32, slice: &mut [T]) {
317
+ assert!(!slice.is_empty());
318
+ let idx = rng.rand_range(0..slice.len() as u32) as usize;
319
+ slice.swap(0, idx);
320
321
0 commit comments