@@ -3,7 +3,7 @@ use std::ops::RangeInclusive;
33use std:: sync:: LazyLock ;
44
55use libm:: support:: Float ;
6- use rand:: distributions :: { Alphanumeric , Standard } ;
6+ use rand:: distr :: { Alphanumeric , StandardUniform } ;
77use rand:: prelude:: Distribution ;
88use rand:: { Rng , SeedableRng } ;
99use rand_chacha:: ChaCha8Rng ;
@@ -16,7 +16,7 @@ pub(crate) const SEED_ENV: &str = "LIBM_SEED";
1616
1717pub static SEED : LazyLock < [ u8 ; 32 ] > = LazyLock :: new ( || {
1818 let s = env:: var ( SEED_ENV ) . unwrap_or_else ( |_| {
19- let mut rng = rand:: thread_rng ( ) ;
19+ let mut rng = rand:: rng ( ) ;
2020 ( 0 ..32 ) . map ( |_| rng. sample ( Alphanumeric ) as char ) . collect ( )
2121 } ) ;
2222
@@ -33,19 +33,19 @@ pub trait RandomInput: Sized {
3333/// Generate a sequence of deterministically random floats.
3434fn random_floats < F : Float > ( count : u64 ) -> impl Iterator < Item = F >
3535where
36- Standard : Distribution < F :: Int > ,
36+ StandardUniform : Distribution < F :: Int > ,
3737{
3838 let mut rng = ChaCha8Rng :: from_seed ( * SEED ) ;
3939
4040 // Generate integers to get a full range of bitpatterns (including NaNs), then convert back
4141 // to the float type.
42- ( 0 ..count) . map ( move |_| F :: from_bits ( rng. gen :: < F :: Int > ( ) ) )
42+ ( 0 ..count) . map ( move |_| F :: from_bits ( rng. random :: < F :: Int > ( ) ) )
4343}
4444
4545/// Generate a sequence of deterministically random `i32`s within a specified range.
4646fn random_ints ( count : u64 , range : RangeInclusive < i32 > ) -> impl Iterator < Item = i32 > {
4747 let mut rng = ChaCha8Rng :: from_seed ( * SEED ) ;
48- ( 0 ..count) . map ( move |_| rng. gen_range :: < i32 , _ > ( range. clone ( ) ) )
48+ ( 0 ..count) . map ( move |_| rng. random_range :: < i32 , _ > ( range. clone ( ) ) )
4949}
5050
5151macro_rules! impl_random_input {
0 commit comments