11//! Generator functions for matrices
22
33use ndarray:: * ;
4- use rand:: prelude :: * ;
4+ use rand:: Rng ;
55
66use super :: convert:: * ;
77use super :: error:: * ;
2424
2525/// Generate random array with given shape
2626///
27- /// - This function uses [rand::thread_rng ].
27+ /// - This function uses [rand::rng ].
2828/// See [random_using] for using another RNG
2929pub fn random < A , S , Sh , D > ( sh : Sh ) -> ArrayBase < S , D >
3030where
3333 D : Dimension ,
3434 Sh : ShapeBuilder < Dim = D > ,
3535{
36- let mut rng = thread_rng ( ) ;
36+ let mut rng = rand :: rng ( ) ;
3737 random_using ( sh, & mut rng)
3838}
3939
@@ -55,13 +55,13 @@ where
5555///
5656/// - Be sure that this it **NOT** a uniform distribution.
5757/// Use it only for test purpose.
58- /// - This function uses [rand::thread_rng ].
58+ /// - This function uses [rand::rng ].
5959/// See [random_unitary_using] for using another RNG.
6060pub fn random_unitary < A > ( n : usize ) -> Array2 < A >
6161where
6262 A : Scalar + Lapack ,
6363{
64- let mut rng = thread_rng ( ) ;
64+ let mut rng = rand :: rng ( ) ;
6565 random_unitary_using ( n, & mut rng)
6666}
6767
@@ -84,13 +84,13 @@ where
8484///
8585/// - Be sure that this it **NOT** a uniform distribution.
8686/// Use it only for test purpose.
87- /// - This function uses [rand::thread_rng ].
87+ /// - This function uses [rand::rng ].
8888/// See [random_regular_using] for using another RNG.
8989pub fn random_regular < A > ( n : usize ) -> Array2 < A >
9090where
9191 A : Scalar + Lapack ,
9292{
93- let mut rng = rand:: thread_rng ( ) ;
93+ let mut rng = rand:: rng ( ) ;
9494 random_regular_using ( n, & mut rng)
9595}
9696
@@ -114,14 +114,14 @@ where
114114
115115/// Random Hermite matrix
116116///
117- /// - This function uses [rand::thread_rng ].
117+ /// - This function uses [rand::rng ].
118118/// See [random_hermite_using] for using another RNG.
119119pub fn random_hermite < A , S > ( n : usize ) -> ArrayBase < S , Ix2 >
120120where
121121 A : Scalar ,
122122 S : DataOwned < Elem = A > + DataMut ,
123123{
124- let mut rng = rand:: thread_rng ( ) ;
124+ let mut rng = rand:: rng ( ) ;
125125 random_hermite_using ( n, & mut rng)
126126}
127127
@@ -147,15 +147,15 @@ where
147147/// Random Hermite Positive-definite matrix
148148///
149149/// - Eigenvalue of matrix must be larger than 1 (thus non-singular)
150- /// - This function uses [rand::thread_rng ].
150+ /// - This function uses [rand::rng ].
151151/// See [random_hpd_using] for using another RNG.
152152///
153153pub fn random_hpd < A , S > ( n : usize ) -> ArrayBase < S , Ix2 >
154154where
155155 A : Scalar ,
156156 S : DataOwned < Elem = A > + DataMut ,
157157{
158- let mut rng = rand:: thread_rng ( ) ;
158+ let mut rng = rand:: rng ( ) ;
159159 random_hpd_using ( n, & mut rng)
160160}
161161
0 commit comments