@@ -509,17 +509,20 @@ where
509509mod tests {
510510 use super :: * ;
511511 use approx:: assert_abs_diff_eq;
512- use ndarray_rand:: { RandomExt , rand:: prelude:: * , rand_distr:: Uniform } ;
512+ use ndarray_rand:: rand:: prelude:: * ;
513+ use ndarray_rand:: rand_distr:: Uniform ;
514+ use ndarray_rand:: { RandomExt , rand} ;
513515
514516 #[ test]
515517 fn box_sum_works ( ) {
516518 let length = 1000 ;
517519 let max_box_len = 100 ;
518- let mut rng = thread_rng ( ) ;
519- let signal = Array1 :: random_using ( length, Uniform :: new_inclusive ( -1. , 1. ) , & mut rng) ;
520+ let mut rng = rand:: rng ( ) ;
521+ let signal =
522+ Array1 :: random_using ( length, Uniform :: new_inclusive ( -1. , 1. ) . unwrap ( ) , & mut rng) ;
520523 let mut box_sum = BoxSum :: new ( max_box_len) ;
521524 let mut box_filter = BoxFilter :: new ( max_box_len) ;
522- let rng_box_len = Uniform :: new_inclusive ( 1 , max_box_len) ;
525+ let rng_box_len = Uniform :: new_inclusive ( 1 , max_box_len) . unwrap ( ) ;
523526
524527 for i in 0 ..length {
525528 let box_len = rng_box_len. sample ( & mut rng) ;
@@ -552,10 +555,10 @@ mod tests {
552555 #[ test]
553556 fn box_sum_drift_works ( ) {
554557 let max_box_len = 100 ;
555- let mut rng = thread_rng ( ) ;
558+ let mut rng = rand :: rng ( ) ;
556559 let mut box_sum = BoxSum :: new ( max_box_len) ;
557560
558- let rng_x = Uniform :: new_inclusive ( 1e6 , 2e6 ) ;
561+ let rng_x = Uniform :: new_inclusive ( 1e6 , 2e6 ) . unwrap ( ) ;
559562 for _ in 0 ..10 {
560563 for _ in 0 ..10000 {
561564 box_sum. write ( rng_x. sample ( & mut rng) ) ;
@@ -566,7 +569,7 @@ mod tests {
566569 box_sum. write ( x) ;
567570 }
568571
569- let rng_box_len = Uniform :: new_inclusive ( 25 , 100 ) ;
572+ let rng_box_len = Uniform :: new_inclusive ( 25 , 100 ) . unwrap ( ) ;
570573 for _ in 0 ..10 {
571574 let box_len = rng_box_len. sample ( & mut rng) ;
572575 let expected = if box_len % 2 == 1 { 1. } else { 0. } ;
@@ -598,8 +601,8 @@ mod tests {
598601 let mut stack = BoxStackFilter :: < f32 > :: with_num_layers ( 50 , 1 ) ;
599602 let ratios = arr1 ( & [ 6. , 3. , 1. ] ) ;
600603 stack. resize ( 101 , ratios) ;
601- let mut rng = thread_rng ( ) ;
602- let rng_x = Uniform :: new_inclusive ( -1. , 1. ) ;
604+ let mut rng = rand :: rng ( ) ;
605+ let rng_x = Uniform :: new_inclusive ( -1. , 1. ) . unwrap ( ) ;
603606
604607 for _ in 0 ..1000 {
605608 let x = rng_x. sample ( & mut rng) ;
0 commit comments