@@ -512,7 +512,7 @@ pub fn sample_slice_ref<'a, R, T>(rng: &mut R, slice: &'a [T], amount: usize) ->
512
512
mod test {
513
513
use super :: * ;
514
514
#[ cfg( feature = "alloc" ) ] use { Rng , SeedableRng } ;
515
- #[ cfg( feature = "alloc" ) ] use :: rand_xorshift :: XorShiftRng ;
515
+ #[ cfg( feature = "alloc" ) ] use rngs :: SmallRng ;
516
516
#[ cfg( all( feature="alloc" , not( feature="std" ) ) ) ]
517
517
use alloc:: vec:: Vec ;
518
518
@@ -753,7 +753,7 @@ mod test {
753
753
#[ cfg( feature = "alloc" ) ]
754
754
#[ allow( deprecated) ]
755
755
fn test_sample_slice ( ) {
756
- let xor_rng = XorShiftRng :: from_seed;
756
+ let seeded_rng = SmallRng :: from_seed;
757
757
758
758
let mut r = :: test:: rng ( 403 ) ;
759
759
@@ -764,16 +764,16 @@ mod test {
764
764
r. fill ( & mut seed) ;
765
765
766
766
// 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) ;
768
768
assert_eq ! ( regular. len( ) , amount) ;
769
769
assert ! ( regular. iter( ) . all( |e| e < length) ) ;
770
770
771
771
// also test that sampling the slice works
772
772
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) ;
774
774
assert_eq ! ( result, regular. iter( ) . map( |i| i as u32 ) . collect:: <Vec <_>>( ) ) ;
775
775
776
- let result = sample_slice_ref ( & mut xor_rng ( seed) , & vec, amount) ;
776
+ let result = sample_slice_ref ( & mut seeded_rng ( seed) , & vec, amount) ;
777
777
assert ! ( result. iter( ) . zip( regular. iter( ) ) . all( |( i, j) | * * i == j as u32 ) ) ;
778
778
}
779
779
}
0 commit comments