@@ -3,7 +3,7 @@ use std::ops::RangeInclusive;
3
3
use std:: sync:: LazyLock ;
4
4
5
5
use libm:: support:: Float ;
6
- use rand:: distributions :: { Alphanumeric , Standard } ;
6
+ use rand:: distr :: { Alphanumeric , StandardUniform } ;
7
7
use rand:: prelude:: Distribution ;
8
8
use rand:: { Rng , SeedableRng } ;
9
9
use rand_chacha:: ChaCha8Rng ;
@@ -16,7 +16,7 @@ pub(crate) const SEED_ENV: &str = "LIBM_SEED";
16
16
17
17
pub static SEED : LazyLock < [ u8 ; 32 ] > = LazyLock :: new ( || {
18
18
let s = env:: var ( SEED_ENV ) . unwrap_or_else ( |_| {
19
- let mut rng = rand:: thread_rng ( ) ;
19
+ let mut rng = rand:: rng ( ) ;
20
20
( 0 ..32 ) . map ( |_| rng. sample ( Alphanumeric ) as char ) . collect ( )
21
21
} ) ;
22
22
@@ -33,19 +33,19 @@ pub trait RandomInput: Sized {
33
33
/// Generate a sequence of deterministically random floats.
34
34
fn random_floats < F : Float > ( count : u64 ) -> impl Iterator < Item = F >
35
35
where
36
- Standard : Distribution < F :: Int > ,
36
+ StandardUniform : Distribution < F :: Int > ,
37
37
{
38
38
let mut rng = ChaCha8Rng :: from_seed ( * SEED ) ;
39
39
40
40
// Generate integers to get a full range of bitpatterns (including NaNs), then convert back
41
41
// 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 > ( ) ) )
43
43
}
44
44
45
45
/// Generate a sequence of deterministically random `i32`s within a specified range.
46
46
fn random_ints ( count : u64 , range : RangeInclusive < i32 > ) -> impl Iterator < Item = i32 > {
47
47
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 ( ) ) )
49
49
}
50
50
51
51
macro_rules! impl_random_input {
0 commit comments