@@ -175,7 +175,7 @@ float_impls! { feature = "simd_support", f64x8, u64x8, f64, u64, 52, 1023 }
175
175
#[ cfg( test) ]
176
176
mod tests {
177
177
use super :: * ;
178
- use crate :: rngs :: mock :: StepRng ;
178
+ use crate :: test :: const_rng ;
179
179
180
180
const EPSILON32 : f32 = f32:: EPSILON ;
181
181
const EPSILON64 : f64 = f64:: EPSILON ;
@@ -187,30 +187,30 @@ mod tests {
187
187
let two = $ty:: splat( 2.0 ) ;
188
188
189
189
// StandardUniform
190
- let mut zeros = StepRng :: new ( 0 , 0 ) ;
190
+ let mut zeros = const_rng ( 0 ) ;
191
191
assert_eq!( zeros. random:: <$ty>( ) , $ZERO) ;
192
- let mut one = StepRng :: new ( 1 << 8 | 1 << ( 8 + 32 ) , 0 ) ;
192
+ let mut one = const_rng ( 1 << 8 | 1 << ( 8 + 32 ) ) ;
193
193
assert_eq!( one. random:: <$ty>( ) , $EPSILON / two) ;
194
- let mut max = StepRng :: new ( ! 0 , 0 ) ;
194
+ let mut max = const_rng ( ! 0 ) ;
195
195
assert_eq!( max. random:: <$ty>( ) , $ty:: splat( 1.0 ) - $EPSILON / two) ;
196
196
197
197
// OpenClosed01
198
- let mut zeros = StepRng :: new ( 0 , 0 ) ;
198
+ let mut zeros = const_rng ( 0 ) ;
199
199
assert_eq!( zeros. sample:: <$ty, _>( OpenClosed01 ) , $ZERO + $EPSILON / two) ;
200
- let mut one = StepRng :: new ( 1 << 8 | 1 << ( 8 + 32 ) , 0 ) ;
200
+ let mut one = const_rng ( 1 << 8 | 1 << ( 8 + 32 ) ) ;
201
201
assert_eq!( one. sample:: <$ty, _>( OpenClosed01 ) , $EPSILON) ;
202
- let mut max = StepRng :: new ( ! 0 , 0 ) ;
202
+ let mut max = const_rng ( ! 0 ) ;
203
203
assert_eq!( max. sample:: <$ty, _>( OpenClosed01 ) , $ZERO + $ty:: splat( 1.0 ) ) ;
204
204
205
205
// Open01
206
- let mut zeros = StepRng :: new ( 0 , 0 ) ;
206
+ let mut zeros = const_rng ( 0 ) ;
207
207
assert_eq!( zeros. sample:: <$ty, _>( Open01 ) , $ZERO + $EPSILON / two) ;
208
- let mut one = StepRng :: new ( 1 << 9 | 1 << ( 9 + 32 ) , 0 ) ;
208
+ let mut one = const_rng ( 1 << 9 | 1 << ( 9 + 32 ) ) ;
209
209
assert_eq!(
210
210
one. sample:: <$ty, _>( Open01 ) ,
211
211
$EPSILON / two * $ty:: splat( 3.0 )
212
212
) ;
213
- let mut max = StepRng :: new ( ! 0 , 0 ) ;
213
+ let mut max = const_rng ( ! 0 ) ;
214
214
assert_eq!(
215
215
max. sample:: <$ty, _>( Open01 ) ,
216
216
$ty:: splat( 1.0 ) - $EPSILON / two
@@ -235,30 +235,30 @@ mod tests {
235
235
let two = $ty:: splat( 2.0 ) ;
236
236
237
237
// StandardUniform
238
- let mut zeros = StepRng :: new ( 0 , 0 ) ;
238
+ let mut zeros = const_rng ( 0 ) ;
239
239
assert_eq!( zeros. random:: <$ty>( ) , $ZERO) ;
240
- let mut one = StepRng :: new ( 1 << 11 , 0 ) ;
240
+ let mut one = const_rng ( 1 << 11 ) ;
241
241
assert_eq!( one. random:: <$ty>( ) , $EPSILON / two) ;
242
- let mut max = StepRng :: new ( ! 0 , 0 ) ;
242
+ let mut max = const_rng ( ! 0 ) ;
243
243
assert_eq!( max. random:: <$ty>( ) , $ty:: splat( 1.0 ) - $EPSILON / two) ;
244
244
245
245
// OpenClosed01
246
- let mut zeros = StepRng :: new ( 0 , 0 ) ;
246
+ let mut zeros = const_rng ( 0 ) ;
247
247
assert_eq!( zeros. sample:: <$ty, _>( OpenClosed01 ) , $ZERO + $EPSILON / two) ;
248
- let mut one = StepRng :: new ( 1 << 11 , 0 ) ;
248
+ let mut one = const_rng ( 1 << 11 ) ;
249
249
assert_eq!( one. sample:: <$ty, _>( OpenClosed01 ) , $EPSILON) ;
250
- let mut max = StepRng :: new ( ! 0 , 0 ) ;
250
+ let mut max = const_rng ( ! 0 ) ;
251
251
assert_eq!( max. sample:: <$ty, _>( OpenClosed01 ) , $ZERO + $ty:: splat( 1.0 ) ) ;
252
252
253
253
// Open01
254
- let mut zeros = StepRng :: new ( 0 , 0 ) ;
254
+ let mut zeros = const_rng ( 0 ) ;
255
255
assert_eq!( zeros. sample:: <$ty, _>( Open01 ) , $ZERO + $EPSILON / two) ;
256
- let mut one = StepRng :: new ( 1 << 12 , 0 ) ;
256
+ let mut one = const_rng ( 1 << 12 ) ;
257
257
assert_eq!(
258
258
one. sample:: <$ty, _>( Open01 ) ,
259
259
$EPSILON / two * $ty:: splat( 3.0 )
260
260
) ;
261
- let mut max = StepRng :: new ( ! 0 , 0 ) ;
261
+ let mut max = const_rng ( ! 0 ) ;
262
262
assert_eq!(
263
263
max. sample:: <$ty, _>( Open01 ) ,
264
264
$ty:: splat( 1.0 ) - $EPSILON / two
0 commit comments