Skip to content

Commit 8b2111c

Browse files
igerberclaude
andcommitted
chore(rust): bump rand 0.8 -> 0.10, rand_xoshiro 0.6 -> 0.8
These two crates are coupled through rand_core and must move together; rand_xoshiro 0.8 requires the rand_core that ships with rand 0.9+. API churn handled in bootstrap.rs (rand 0.9 renamed the gen* family): - rng.gen::<bool>() -> rng.random::<bool>() - rng.gen::<f64>() -> rng.random::<f64>() - rng.gen_range(0..6) -> rng.random_range(0..6) Bit-identity preserved: Xoshiro256PlusPlus::seed_from_u64(seed) produces the same byte stream in 0.6 and 0.8, so existing bootstrap baselines remain valid. Verified locally on macOS Accelerate: - tests/test_rust_backend.py: 95 passed (includes Rust<->Python parity tests on bootstrap weights and bootstrap-derived SE/CI quantiles) - Bootstrap-focused sweep across the broader test suite: 372 passed - 467 total passing across the directly affected surfaces Supersedes igerber#382 (rand) and igerber#384 (rand_xoshiro). blas-src 0.10 -> 0.14 (igerber#386) deferred pending an ndarray compatibility check; out of scope. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent dbe4080 commit 8b2111c

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

rust/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ openblas = ["ndarray/blas"]
2525
pyo3 = "0.28"
2626
numpy = "0.28"
2727
ndarray = { version = "0.17", features = ["rayon"] }
28-
rand = "0.8"
29-
rand_xoshiro = "0.6"
28+
rand = "0.10"
29+
rand_xoshiro = "0.8"
3030
rayon = "1.8"
3131

3232
# Pure Rust linear algebra for SVD/matrix inversion (no external deps).

rust/src/bootstrap.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ fn generate_rademacher_batch(n_bootstrap: usize, n_units: usize, seed: u64) -> A
6767
.for_each(|(i, mut row)| {
6868
let mut rng = Xoshiro256PlusPlus::seed_from_u64(seed.wrapping_add(i as u64));
6969
for elem in row.iter_mut() {
70-
*elem = if rng.gen::<bool>() { 1.0 } else { -1.0 };
70+
*elem = if rng.random::<bool>() { 1.0 } else { -1.0 };
7171
}
7272
});
7373

@@ -102,7 +102,7 @@ fn generate_mammen_batch(n_bootstrap: usize, n_units: usize, seed: u64) -> Array
102102
.for_each(|(i, mut row)| {
103103
let mut rng = Xoshiro256PlusPlus::seed_from_u64(seed.wrapping_add(i as u64));
104104
for elem in row.iter_mut() {
105-
*elem = if rng.gen::<f64>() < prob_neg {
105+
*elem = if rng.random::<f64>() < prob_neg {
106106
val_neg
107107
} else {
108108
val_pos
@@ -142,7 +142,7 @@ fn generate_webb_batch(n_bootstrap: usize, n_units: usize, seed: u64) -> Array2<
142142
let mut rng = Xoshiro256PlusPlus::seed_from_u64(seed.wrapping_add(i as u64));
143143
for elem in row.iter_mut() {
144144
// Uniform selection: generate integer 0-5, index into weights_table
145-
let bucket = rng.gen_range(0..6);
145+
let bucket = rng.random_range(0..6);
146146
*elem = weights_table[bucket];
147147
}
148148
});

0 commit comments

Comments
 (0)