From 9322664f5e01c2749279c21fa3a007fa9065757a Mon Sep 17 00:00:00 2001
From: Dirreke <mingyang_ge@163.com>
Date: Fri, 6 Jun 2025 23:55:05 +0800
Subject: [PATCH] Bump rand from 0.8 to 0.9

---
 lax/Cargo.toml                 |  2 +-
 ndarray-linalg/Cargo.toml      |  8 ++++----
 ndarray-linalg/src/generate.rs | 22 +++++++++++-----------
 3 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/lax/Cargo.toml b/lax/Cargo.toml
index 076d5cf2..e34028fa 100644
--- a/lax/Cargo.toml
+++ b/lax/Cargo.toml
@@ -30,7 +30,7 @@ intel-mkl-system = ["intel-mkl-src/mkl-dynamic-lp64-seq"]
 
 [dependencies]
 thiserror = "2.0.0"
-cauchy = "0.4.0"
+cauchy = {git="https://github.com/Dirreke/cauchy.git", branch="bump-rand"}
 num-traits = "0.2.14"
 lapack-sys = "0.15.0"
 katexit = "0.1.2"
diff --git a/ndarray-linalg/Cargo.toml b/ndarray-linalg/Cargo.toml
index 8c5c83a8..f1d33d61 100644
--- a/ndarray-linalg/Cargo.toml
+++ b/ndarray-linalg/Cargo.toml
@@ -30,11 +30,11 @@ intel-mkl-static = ["lax/intel-mkl-static"]
 intel-mkl-system = ["lax/intel-mkl-system"]
 
 [dependencies]
-cauchy = "0.4.0"
+cauchy = {git="https://github.com/Dirreke/cauchy.git", branch="bump-rand"}
 katexit = "0.1.2"
-num-complex = "0.4.0"
+num-complex = {git="https://github.com/Dirreke/num-complex.git", branch="bump-rand"}
 num-traits  = "0.2.14"
-rand = "0.8.3"
+rand = "0.9"
 thiserror = "2.0.0"
 
 [dependencies.ndarray]
@@ -52,7 +52,7 @@ paste = "1.0.5"
 criterion = "0.5.1"
 # Keep the same version as ndarray's dependency!
 approx = { version = "0.5", features = ["num-complex"] }
-rand_pcg = "0.3.1"
+rand_pcg = "0.9"
 
 [[bench]]
 name = "truncated_eig"
diff --git a/ndarray-linalg/src/generate.rs b/ndarray-linalg/src/generate.rs
index 5646c808..965aa5ff 100644
--- a/ndarray-linalg/src/generate.rs
+++ b/ndarray-linalg/src/generate.rs
@@ -1,7 +1,7 @@
 //! Generator functions for matrices
 
 use ndarray::*;
-use rand::prelude::*;
+use rand::Rng;
 
 use super::convert::*;
 use super::error::*;
@@ -24,7 +24,7 @@ where
 
 /// Generate random array with given shape
 ///
-/// - This function uses [rand::thread_rng].
+/// - This function uses [rand::rng].
 ///   See [random_using] for using another RNG
 pub fn random<A, S, Sh, D>(sh: Sh) -> ArrayBase<S, D>
 where
@@ -33,7 +33,7 @@ where
     D: Dimension,
     Sh: ShapeBuilder<Dim = D>,
 {
-    let mut rng = thread_rng();
+    let mut rng = rand::rng();
     random_using(sh, &mut rng)
 }
 
@@ -55,13 +55,13 @@ where
 ///
 /// - Be sure that this it **NOT** a uniform distribution.
 ///   Use it only for test purpose.
-/// - This function uses [rand::thread_rng].
+/// - This function uses [rand::rng].
 ///   See [random_unitary_using] for using another RNG.
 pub fn random_unitary<A>(n: usize) -> Array2<A>
 where
     A: Scalar + Lapack,
 {
-    let mut rng = thread_rng();
+    let mut rng = rand::rng();
     random_unitary_using(n, &mut rng)
 }
 
@@ -84,13 +84,13 @@ where
 ///
 /// - Be sure that this it **NOT** a uniform distribution.
 ///   Use it only for test purpose.
-/// - This function uses [rand::thread_rng].
+/// - This function uses [rand::rng].
 ///   See [random_regular_using] for using another RNG.
 pub fn random_regular<A>(n: usize) -> Array2<A>
 where
     A: Scalar + Lapack,
 {
-    let mut rng = rand::thread_rng();
+    let mut rng = rand::rng();
     random_regular_using(n, &mut rng)
 }
 
@@ -114,14 +114,14 @@ where
 
 /// Random Hermite matrix
 ///
-/// - This function uses [rand::thread_rng].
+/// - This function uses [rand::rng].
 ///   See [random_hermite_using] for using another RNG.
 pub fn random_hermite<A, S>(n: usize) -> ArrayBase<S, Ix2>
 where
     A: Scalar,
     S: DataOwned<Elem = A> + DataMut,
 {
-    let mut rng = rand::thread_rng();
+    let mut rng = rand::rng();
     random_hermite_using(n, &mut rng)
 }
 
@@ -147,7 +147,7 @@ where
 /// Random Hermite Positive-definite matrix
 ///
 /// - Eigenvalue of matrix must be larger than 1 (thus non-singular)
-/// - This function uses [rand::thread_rng].
+/// - This function uses [rand::rng].
 ///   See [random_hpd_using] for using another RNG.
 ///
 pub fn random_hpd<A, S>(n: usize) -> ArrayBase<S, Ix2>
@@ -155,7 +155,7 @@ where
     A: Scalar,
     S: DataOwned<Elem = A> + DataMut,
 {
-    let mut rng = rand::thread_rng();
+    let mut rng = rand::rng();
     random_hpd_using(n, &mut rng)
 }