@@ -9,7 +9,7 @@ use quickcheck::{Arbitrary, Gen};
9
9
use num:: { Bounded , One , Zero } ;
10
10
#[ cfg( feature = "rand-no-std" ) ]
11
11
use rand:: {
12
- distributions :: { Distribution , Standard } ,
12
+ distr :: { Distribution , StandardUniform } ,
13
13
Rng ,
14
14
} ;
15
15
@@ -293,10 +293,10 @@ where
293
293
#[ cfg( feature = "rand" ) ]
294
294
pub fn new_random_generic ( nrows : R , ncols : C ) -> Self
295
295
where
296
- Standard : Distribution < T > ,
296
+ StandardUniform : Distribution < T > ,
297
297
{
298
- let mut rng = rand:: thread_rng ( ) ;
299
- Self :: from_fn_generic ( nrows, ncols, |_, _| rng. gen ( ) )
298
+ let mut rng = rand:: rng ( ) ;
299
+ Self :: from_fn_generic ( nrows, ncols, |_, _| rng. random ( ) )
300
300
}
301
301
302
302
/// Creates a matrix filled with random values from the given distribution.
@@ -637,7 +637,7 @@ macro_rules! impl_constructors(
637
637
#[ inline]
638
638
#[ cfg( feature = "rand" ) ]
639
639
pub fn new_random( $( $args: usize ) ,* ) -> Self
640
- where Standard : Distribution <T > {
640
+ where StandardUniform : Distribution <T > {
641
641
Self :: new_random_generic( $( $gargs) ,* )
642
642
}
643
643
}
@@ -856,17 +856,19 @@ where
856
856
}
857
857
858
858
#[ cfg( feature = "rand-no-std" ) ]
859
- impl < T : Scalar , R : Dim , C : Dim > Distribution < OMatrix < T , R , C > > for Standard
859
+ impl < T : Scalar , R : Dim , C : Dim > Distribution < OMatrix < T , R , C > > for StandardUniform
860
860
where
861
861
DefaultAllocator : Allocator < R , C > ,
862
- Standard : Distribution < T > ,
862
+ StandardUniform : Distribution < T > ,
863
863
{
864
864
#[ inline]
865
865
fn sample < G : Rng + ?Sized > ( & self , rng : & mut G ) -> OMatrix < T , R , C > {
866
- let nrows = R :: try_to_usize ( ) . unwrap_or_else ( || rng. gen_range ( 0 ..10 ) ) ;
867
- let ncols = C :: try_to_usize ( ) . unwrap_or_else ( || rng. gen_range ( 0 ..10 ) ) ;
866
+ let nrows = R :: try_to_usize ( ) . unwrap_or_else ( || rng. random_range ( 0 ..10 ) ) ;
867
+ let ncols = C :: try_to_usize ( ) . unwrap_or_else ( || rng. random_range ( 0 ..10 ) ) ;
868
868
869
- OMatrix :: from_fn_generic ( R :: from_usize ( nrows) , C :: from_usize ( ncols) , |_, _| rng. gen ( ) )
869
+ OMatrix :: from_fn_generic ( R :: from_usize ( nrows) , C :: from_usize ( ncols) , |_, _| {
870
+ rng. random ( )
871
+ } )
870
872
}
871
873
}
872
874
@@ -892,7 +894,7 @@ where
892
894
893
895
// TODO(specialization): faster impls possible for D≤4 (see rand_distr::{UnitCircle, UnitSphere})
894
896
#[ cfg( feature = "rand" ) ]
895
- impl < T : crate :: RealField , D : DimName > Distribution < Unit < OVector < T , D > > > for Standard
897
+ impl < T : crate :: RealField , D : DimName > Distribution < Unit < OVector < T , D > > > for StandardUniform
896
898
where
897
899
DefaultAllocator : Allocator < D > ,
898
900
rand_distr:: StandardNormal : Distribution < T > ,
0 commit comments