Skip to content

Commit 83ab2d7

Browse files
committed
Replace extraneous usage of XorShiftRng
1 parent 36d65c8 commit 83ab2d7

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/seq/mod.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,7 @@ pub fn sample_slice_ref<'a, R, T>(rng: &mut R, slice: &'a [T], amount: usize) ->
512512
mod test {
513513
use super::*;
514514
#[cfg(feature = "alloc")] use {Rng, SeedableRng};
515-
#[cfg(feature = "alloc")] use ::rand_xorshift::XorShiftRng;
515+
#[cfg(feature = "alloc")] use rngs::SmallRng;
516516
#[cfg(all(feature="alloc", not(feature="std")))]
517517
use alloc::vec::Vec;
518518

@@ -753,7 +753,7 @@ mod test {
753753
#[cfg(feature = "alloc")]
754754
#[allow(deprecated)]
755755
fn test_sample_slice() {
756-
let xor_rng = XorShiftRng::from_seed;
756+
let seeded_rng = SmallRng::from_seed;
757757

758758
let mut r = ::test::rng(403);
759759

@@ -764,16 +764,16 @@ mod test {
764764
r.fill(&mut seed);
765765

766766
// assert the basics work
767-
let regular = index::sample(&mut xor_rng(seed), length, amount);
767+
let regular = index::sample(&mut seeded_rng(seed), length, amount);
768768
assert_eq!(regular.len(), amount);
769769
assert!(regular.iter().all(|e| e < length));
770770

771771
// also test that sampling the slice works
772772
let vec: Vec<u32> = (0..(length as u32)).collect();
773-
let result = sample_slice(&mut xor_rng(seed), &vec, amount);
773+
let result = sample_slice(&mut seeded_rng(seed), &vec, amount);
774774
assert_eq!(result, regular.iter().map(|i| i as u32).collect::<Vec<_>>());
775775

776-
let result = sample_slice_ref(&mut xor_rng(seed), &vec, amount);
776+
let result = sample_slice_ref(&mut seeded_rng(seed), &vec, amount);
777777
assert!(result.iter().zip(regular.iter()).all(|(i,j)| **i == j as u32));
778778
}
779779
}

0 commit comments

Comments
 (0)