@@ -2313,7 +2313,7 @@ pub mod theil_sen {
2313
2313
let mut s1 = [ 0.0 ; 20 ] ;
2314
2314
let mut s2 = [ 0.0 ; 20 ] ;
2315
2315
2316
- let mut rng = rand:: thread_rng ( ) ;
2316
+ let mut rng = rand:: rng ( ) ;
2317
2317
rng. fill ( & mut s1) ;
2318
2318
rng. fill ( & mut s2) ;
2319
2319
@@ -3495,8 +3495,8 @@ pub mod binary_search {
3495
3495
// decrease randomness at the end
3496
3496
let progress = 1.0 - iter as f64 / self . iterations as f64 ;
3497
3497
// gen f32 since that takes less bytes
3498
- let rng_factor =
3499
- 1. + ( 2.0 * rng. gen :: < f32 > ( ) as f64 - 1. ) * self . randomness_factor * progress;
3498
+ let rng_factor = 1.
3499
+ + ( 2.0 * rng. random :: < f32 > ( ) as f64 - 1. ) * self . randomness_factor * progress;
3500
3500
3501
3501
// for each variable to optimize
3502
3502
for i in 0 ..n {
@@ -3573,7 +3573,7 @@ pub mod binary_search {
3573
3573
impl $name for Options {
3574
3574
fn $method( & self , predictors: & [ f64 ] , outcomes: & [ f64 ] ) -> $ret {
3575
3575
use rand:: SeedableRng ;
3576
- let mut rng = rand_xorshift:: XorShiftRng :: from_rng( rand:: thread_rng ( ) ) . unwrap ( ) ;
3576
+ let mut rng = rand_xorshift:: XorShiftRng :: from_rng( & mut rand:: rng ( ) ) ;
3577
3577
3578
3578
#[ cfg( feature = "random_subset_regression" ) ]
3579
3579
if let Some ( random_config) = & self . random_subset_regression {
@@ -3619,7 +3619,7 @@ pub mod binary_search {
3619
3619
impl $name for Options {
3620
3620
fn $method( & self , predictors: & [ f64 ] , outcomes: & [ f64 ] , max_frequency: f64 ) -> $ret {
3621
3621
use rand:: SeedableRng ;
3622
- let mut rng = rand_xorshift:: XorShiftRng :: from_rng( rand:: thread_rng ( ) ) . unwrap ( ) ;
3622
+ let mut rng = rand_xorshift:: XorShiftRng :: from_rng( & mut rand:: rng ( ) ) ;
3623
3623
3624
3624
#[ cfg( feature = "random_subset_regression" ) ]
3625
3625
if let Some ( random_config) = & self . random_subset_regression {
@@ -3730,7 +3730,7 @@ pub mod binary_search {
3730
3730
degree : usize ,
3731
3731
) -> PolynomialCoefficients {
3732
3732
use rand:: SeedableRng ;
3733
- let mut rng = rand_xorshift:: XorShiftRng :: from_rng ( rand:: thread_rng ( ) ) . unwrap ( ) ;
3733
+ let mut rng = rand_xorshift:: XorShiftRng :: from_rng ( & mut rand:: rng ( ) ) ;
3734
3734
3735
3735
#[ cfg( feature = "random_subset_regression" ) ]
3736
3736
if let Some ( random_config) = & self . random_subset_regression {
@@ -3793,7 +3793,7 @@ pub mod binary_search {
3793
3793
#[ test]
3794
3794
#[ cfg( feature = "binary_search_rng" ) ]
3795
3795
fn two_variable_regression ( ) {
3796
- let mut rng = rand:: thread_rng ( ) ;
3796
+ let mut rng = rand:: rng ( ) ;
3797
3797
let now = std:: time:: Instant :: now ( ) ;
3798
3798
let x = [ 1.3 , 4.7 , 9.4 ] ;
3799
3799
let y = [ 4. , 5.3 , 6.7 ] ;
@@ -3822,7 +3822,7 @@ pub mod binary_search {
3822
3822
#[ cfg( feature = "binary_search_rng" ) ]
3823
3823
fn second_degree_regression ( ) {
3824
3824
// init thread rng
3825
- let _rng = rand:: thread_rng ( ) ;
3825
+ let _rng = rand:: rng ( ) ;
3826
3826
let now = std:: time:: Instant :: now ( ) ;
3827
3827
let x = [ 1.3 , 4.7 , 9.4 ] ;
3828
3828
let y = [ 4. , 5.3 , 6.7 ] ;
@@ -3839,7 +3839,7 @@ pub mod binary_search {
3839
3839
use rand:: SeedableRng ;
3840
3840
// init thread rng
3841
3841
3842
- let mut rng = rand_xorshift:: XorShiftRng :: from_rng ( rand:: thread_rng ( ) ) . unwrap ( ) ;
3842
+ let mut rng = rand_xorshift:: XorShiftRng :: from_rng ( & mut rand:: rng ( ) ) ;
3843
3843
let now = std:: time:: Instant :: now ( ) ;
3844
3844
let coeffs = Options :: default ( )
3845
3845
. max_precision ( )
@@ -3912,7 +3912,7 @@ pub mod random_subset_regression {
3912
3912
) ;
3913
3913
return None ;
3914
3914
}
3915
- let distribution = rand:: distributions :: Uniform :: new ( 0 , x. len ( ) ) ;
3915
+ let distribution = rand:: distr :: Uniform :: new ( 0 , x. len ( ) ) . unwrap ( ) ;
3916
3916
let subsets = ( 0 ..config. subsets_count )
3917
3917
. map ( |_| {
3918
3918
let mut new_x = Vec :: with_capacity ( config. subset_length ) ;
0 commit comments