@@ -9,7 +9,7 @@ use quickcheck::{Arbitrary, Gen};
99use num:: { Bounded , One , Zero } ;
1010#[ cfg( feature = "rand-no-std" ) ]
1111use rand:: {
12- distributions :: { Distribution , Standard } ,
12+ distr :: { Distribution , StandardUniform } ,
1313 Rng ,
1414} ;
1515
@@ -293,10 +293,10 @@ where
293293 #[ cfg( feature = "rand" ) ]
294294 pub fn new_random_generic ( nrows : R , ncols : C ) -> Self
295295 where
296- Standard : Distribution < T > ,
296+ StandardUniform : Distribution < T > ,
297297 {
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 ( ) )
300300 }
301301
302302 /// Creates a matrix filled with random values from the given distribution.
@@ -637,7 +637,7 @@ macro_rules! impl_constructors(
637637 #[ inline]
638638 #[ cfg( feature = "rand" ) ]
639639 pub fn new_random( $( $args: usize ) ,* ) -> Self
640- where Standard : Distribution <T > {
640+ where StandardUniform : Distribution <T > {
641641 Self :: new_random_generic( $( $gargs) ,* )
642642 }
643643 }
@@ -856,17 +856,19 @@ where
856856}
857857
858858#[ 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
860860where
861861 DefaultAllocator : Allocator < R , C > ,
862- Standard : Distribution < T > ,
862+ StandardUniform : Distribution < T > ,
863863{
864864 #[ inline]
865865 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 ) ) ;
868868
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+ } )
870872 }
871873}
872874
@@ -892,7 +894,7 @@ where
892894
893895// TODO(specialization): faster impls possible for D≤4 (see rand_distr::{UnitCircle, UnitSphere})
894896#[ 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
896898where
897899 DefaultAllocator : Allocator < D > ,
898900 rand_distr:: StandardNormal : Distribution < T > ,
0 commit comments