arnaucube
arnaucube/poulpyPublic Self-hosted repository
updated rand to latest versions
Jean-Philippe Bossuat jeanphilippe.bossuat@gmail.com
Thu, 24 Apr 2025 18:13:57 +0200
commit

b33a96e80a96181ccbd60f9a82714ac869a742d9

parent

640387d84052a36e1d82c5fee63a94a9dc9cb2c5

4 files changed, 48 insertions(+), 25 deletions(-)

jump to
M Cargo.lock → Cargo.lock

@@ -50,6 +50,12 @@ "utils",

] [[package]] +name = "bitflags" +version = "2.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c8214115b7bf84099f1309324e63141d4c5d7cc26862f97a0a857dbefe165bd" + +[[package]] name = "bumpalo" version = "3.16.0" source = "registry+https://github.com/rust-lang/crates.io-index"

@@ -206,12 +212,13 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"

[[package]] name = "getrandom" -version = "0.2.15" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" +checksum = "73fea8450eea4bac3940448fb7ae50d91f034f941199fcd9d909a5a07aa455f0" dependencies = [ "cfg-if", "libc", + "r-efi", "wasi", ]

@@ -388,21 +395,26 @@ "proc-macro2",

] [[package]] +name = "r-efi" +version = "5.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74765f6d916ee2faa39bc8e68e4f3ed8949b48cccdac59983d287a7cb71ce9c5" + +[[package]] name = "rand" -version = "0.8.5" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +checksum = "9fbfd9d094a40bf3ae768db9361049ace4c0e04a4fd6b359518bd7b73a73dd97" dependencies = [ - "libc", "rand_chacha", "rand_core", ] [[package]] name = "rand_chacha" -version = "0.3.1" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" dependencies = [ "ppv-lite86", "rand_core",

@@ -410,18 +422,18 @@ ]

[[package]] name = "rand_core" -version = "0.6.4" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" dependencies = [ "getrandom", ] [[package]] name = "rand_distr" -version = "0.4.3" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32cb0b9bc82b0a0876c2dd994a7e7a2683d3e7390ca40e6886785ef0c7e3ee31" +checksum = "6a8615d50dcf34fa31f7ab52692afec947c4dd0ab803cc87cb3b0b4570ff7463" dependencies = [ "num-traits", "rand",

@@ -602,9 +614,12 @@ ]

[[package]] name = "wasi" -version = "0.11.0+wasi-snapshot-preview1" +version = "0.14.2+wasi-0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" +checksum = "9683f9a5a998d873c0d21fcbe3c083009670149a8fab228644b8bd36b2c48cb3" +dependencies = [ + "wit-bindgen-rt", +] [[package]] name = "wasm-bindgen"

@@ -760,6 +775,15 @@ name = "windows_x86_64_msvc"

version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "wit-bindgen-rt" +version = "0.39.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f42320e61fe2cfd34354ecb597f86f413484a798ba44a8ca1165c58d42da6c1" +dependencies = [ + "bitflags", +] [[package]] name = "zerocopy"
M Cargo.toml → Cargo.toml

@@ -4,9 +4,9 @@

[workspace.dependencies] rug = "1.27" -rand = "0.8.4" -rand_chacha = "0.3.1" -rand_core = "0.6.4" -rand_distr = "0.4.3" +rand = "0.9.1" +rand_chacha = "0.9.0" +rand_core = "0.9.3" +rand_distr = "0.5.1" itertools = "0.14.0" criterion = "0.5.1"
M base2k/src/svp.rs → base2k/src/svp.rs

@@ -5,7 +5,7 @@

use crate::{Infos, alloc_aligned, cast_mut}; use rand::seq::SliceRandom; use rand_core::RngCore; -use rand_distr::{Distribution, WeightedIndex}; +use rand_distr::{Distribution, weighted::WeightedIndex}; use sampling::source::Source; pub struct Scalar {
M sampling/src/source.rs → sampling/src/source.rs

@@ -1,6 +1,6 @@

use rand_chacha::ChaCha8Rng; use rand_chacha::rand_core::SeedableRng; -use rand_core::{OsRng, RngCore}; +use rand_core::{OsRng, RngCore, TryRngCore}; const MAXF64: f64 = 9007199254740992.0;

@@ -10,7 +10,7 @@ }

pub fn new_seed() -> [u8; 32] { let mut seed = [0u8; 32]; - OsRng.fill_bytes(&mut seed); + OsRng.try_fill_bytes(&mut seed).unwrap(); seed }

@@ -44,6 +44,10 @@ #[inline(always)]

pub fn next_f64(&mut self, min: f64, max: f64) -> f64 { min + ((self.next_u64() << 11 >> 11) as f64) / MAXF64 * (max - min) } + + pub fn next_i64(&mut self) -> i64{ + self.next_u64() as i64 + } } impl RngCore for Source {

@@ -60,10 +64,5 @@

#[inline(always)] fn fill_bytes(&mut self, bytes: &mut [u8]) { self.source.fill_bytes(bytes) - } - - #[inline(always)] - fn try_fill_bytes(&mut self, bytes: &mut [u8]) -> Result<(), rand_core::Error> { - self.source.try_fill_bytes(bytes) } }