chore: update rand dependency to v0.9.0 (#398)

This commit is contained in:
Santiago Pittella 2025-03-13 16:13:49 -03:00 committed by GitHub
parent 222197d08f
commit d5b38a8b35
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 88 additions and 163 deletions

View file

@ -12,6 +12,7 @@
- Skip unchanged leaves in the concurrent implementation of `Smt::compute_mutations` (#385). - Skip unchanged leaves in the concurrent implementation of `Smt::compute_mutations` (#385).
- Add range checks to `ntru_gen` for Falcon DSA (#391). - Add range checks to `ntru_gen` for Falcon DSA (#391).
- Optimized duplicate key detection in `Smt::with_entries_concurrent` (#395). - Optimized duplicate key detection in `Smt::with_entries_concurrent` (#395).
- [BREAKING] Moved `rand` to version `0.9` removing the `try_fill_bytes` method (#398).
## 0.13.3 (2025-02-18) ## 0.13.3 (2025-02-18)

187
Cargo.lock generated
View file

@ -97,21 +97,6 @@ version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26"
[[package]]
name = "bit-set"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "08807e080ed7f9d5433fa9b275196cfc35414f66a0c79d864dc51a0d825231a3"
dependencies = [
"bit-vec",
]
[[package]]
name = "bit-vec"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5e764a1d40d510daf35e07be9eb06e75770908c27d411ee6c92109c9840eaaf7"
[[package]] [[package]]
name = "bitflags" name = "bitflags"
version = "2.8.0" version = "2.8.0"
@ -362,28 +347,6 @@ version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f"
[[package]]
name = "errno"
version = "0.3.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "33d852cb9b869c2a9b3df2f71a3074817f01e1844f839a144f5fcef059a4eb5d"
dependencies = [
"libc",
"windows-sys",
]
[[package]]
name = "fastrand"
version = "2.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be"
[[package]]
name = "fnv"
version = "1.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
[[package]] [[package]]
name = "foldhash" name = "foldhash"
version = "0.1.4" version = "0.1.4"
@ -407,10 +370,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"js-sys",
"libc", "libc",
"wasi 0.11.0+wasi-snapshot-preview1", "wasi 0.11.0+wasi-snapshot-preview1",
"wasm-bindgen",
] ]
[[package]] [[package]]
@ -532,12 +493,6 @@ dependencies = [
"cpufeatures", "cpufeatures",
] ]
[[package]]
name = "lazy_static"
version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
[[package]] [[package]]
name = "libc" name = "libc"
version = "0.2.169" version = "0.2.169"
@ -550,12 +505,6 @@ version = "0.2.11"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8355be11b20d696c8f18f6cc018c4e372165b1fa8126cef092399c9951984ffa" checksum = "8355be11b20d696c8f18f6cc018c4e372165b1fa8126cef092399c9951984ffa"
[[package]]
name = "linux-raw-sys"
version = "0.4.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab"
[[package]] [[package]]
name = "log" name = "log"
version = "0.4.25" version = "0.4.25"
@ -577,16 +526,16 @@ dependencies = [
"cc", "cc",
"clap", "clap",
"criterion", "criterion",
"getrandom 0.2.15", "getrandom 0.3.1",
"glob", "glob",
"hashbrown", "hashbrown",
"hex", "hex",
"num", "num",
"num-complex", "num-complex",
"proptest", "proptest",
"rand", "rand 0.9.0",
"rand_chacha", "rand_chacha 0.9.0",
"rand_core", "rand_core 0.9.3",
"rayon", "rayon",
"seq-macro", "seq-macro",
"serde", "serde",
@ -718,7 +667,7 @@ version = "0.2.20"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04" checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04"
dependencies = [ dependencies = [
"zerocopy", "zerocopy 0.7.35",
] ]
[[package]] [[package]]
@ -736,26 +685,14 @@ version = "1.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "14cae93065090804185d3b75f0bf93b8eeda30c7a9b4a33d3bdb3988d6229e50" checksum = "14cae93065090804185d3b75f0bf93b8eeda30c7a9b4a33d3bdb3988d6229e50"
dependencies = [ dependencies = [
"bit-set",
"bit-vec",
"bitflags", "bitflags",
"lazy_static",
"num-traits", "num-traits",
"rand", "rand 0.8.5",
"rand_chacha", "rand_chacha 0.3.1",
"rand_xorshift", "rand_xorshift",
"regex-syntax",
"rusty-fork",
"tempfile",
"unarray", "unarray",
] ]
[[package]]
name = "quick-error"
version = "1.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0"
[[package]] [[package]]
name = "quote" name = "quote"
version = "1.0.38" version = "1.0.38"
@ -772,8 +709,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"
dependencies = [ dependencies = [
"libc", "libc",
"rand_chacha", "rand_chacha 0.3.1",
"rand_core", "rand_core 0.6.4",
]
[[package]]
name = "rand"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3779b94aeb87e8bd4e834cee3650289ee9e0d5677f976ecdb6d219e5f4f6cd94"
dependencies = [
"rand_chacha 0.9.0",
"rand_core 0.9.3",
"zerocopy 0.8.23",
] ]
[[package]] [[package]]
@ -783,7 +731,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
dependencies = [ dependencies = [
"ppv-lite86", "ppv-lite86",
"rand_core", "rand_core 0.6.4",
]
[[package]]
name = "rand_chacha"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb"
dependencies = [
"ppv-lite86",
"rand_core 0.9.3",
] ]
[[package]] [[package]]
@ -795,13 +753,22 @@ dependencies = [
"getrandom 0.2.15", "getrandom 0.2.15",
] ]
[[package]]
name = "rand_core"
version = "0.9.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38"
dependencies = [
"getrandom 0.3.1",
]
[[package]] [[package]]
name = "rand_xorshift" name = "rand_xorshift"
version = "0.3.0" version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d25bf25ec5ae4a3f1b92f929810509a2f53d7dca2f50b794ff57e3face536c8f" checksum = "d25bf25ec5ae4a3f1b92f929810509a2f53d7dca2f50b794ff57e3face536c8f"
dependencies = [ dependencies = [
"rand_core", "rand_core 0.6.4",
] ]
[[package]] [[package]]
@ -853,37 +820,12 @@ version = "0.8.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c"
[[package]]
name = "rustix"
version = "0.38.44"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154"
dependencies = [
"bitflags",
"errno",
"libc",
"linux-raw-sys",
"windows-sys",
]
[[package]] [[package]]
name = "rustversion" name = "rustversion"
version = "1.0.19" version = "1.0.19"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f7c45b9784283f1b2e7fb61b42047c2fd678ef0960d4f6f1eba131594cc369d4" checksum = "f7c45b9784283f1b2e7fb61b42047c2fd678ef0960d4f6f1eba131594cc369d4"
[[package]]
name = "rusty-fork"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cb3dcc6e454c328bb824492db107ab7c0ae8fcffe4ad210136ef014458c1bc4f"
dependencies = [
"fnv",
"quick-error",
"tempfile",
"wait-timeout",
]
[[package]] [[package]]
name = "ryu" name = "ryu"
version = "1.0.19" version = "1.0.19"
@ -970,20 +912,6 @@ dependencies = [
"unicode-ident", "unicode-ident",
] ]
[[package]]
name = "tempfile"
version = "3.17.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "22e5a0acb1f3f55f65cc4a866c361b2fb2a0ff6366785ae6fbb5f85df07ba230"
dependencies = [
"cfg-if",
"fastrand",
"getrandom 0.3.1",
"once_cell",
"rustix",
"windows-sys",
]
[[package]] [[package]]
name = "thiserror" name = "thiserror"
version = "2.0.11" version = "2.0.11"
@ -1044,15 +972,6 @@ version = "0.9.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"
[[package]]
name = "wait-timeout"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09ac3b126d3914f9849036f826e054cbabdc8519970b8998ddaf3b5bd3c65f11"
dependencies = [
"libc",
]
[[package]] [[package]]
name = "walkdir" name = "walkdir"
version = "2.5.0" version = "2.5.0"
@ -1256,7 +1175,7 @@ version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fc6321741f063344258c80f0c0255a559ded99bc17fe99fab9577f2460065ddf" checksum = "fc6321741f063344258c80f0c0255a559ded99bc17fe99fab9577f2460065ddf"
dependencies = [ dependencies = [
"rand", "rand 0.8.5",
"winter-utils", "winter-utils",
] ]
@ -1282,7 +1201,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0"
dependencies = [ dependencies = [
"byteorder", "byteorder",
"zerocopy-derive", "zerocopy-derive 0.7.35",
]
[[package]]
name = "zerocopy"
version = "0.8.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fd97444d05a4328b90e75e503a34bad781f14e28a823ad3557f0750df1ebcbc6"
dependencies = [
"zerocopy-derive 0.8.23",
] ]
[[package]] [[package]]
@ -1295,3 +1223,14 @@ dependencies = [
"quote", "quote",
"syn", "syn",
] ]
[[package]]
name = "zerocopy-derive"
version = "0.8.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6352c01d0edd5db859a63e2605f4ea3183ddbd15e2c4a9e7d32184df75e4f154"
dependencies = [
"proc-macro2",
"quote",
"syn",
]

View file

@ -55,7 +55,7 @@ std = [
"blake3/std", "blake3/std",
"dep:cc", "dep:cc",
"rand/std", "rand/std",
"rand/std_rng", "rand/thread_rng",
"winter-crypto/std", "winter-crypto/std",
"winter-math/std", "winter-math/std",
"winter-utils/std", "winter-utils/std",
@ -67,8 +67,8 @@ clap = { version = "4.5", optional = true, features = ["derive"] }
hashbrown = { version = "0.15", optional = true, features = ["serde"] } hashbrown = { version = "0.15", optional = true, features = ["serde"] }
num = { version = "0.4", default-features = false, features = ["alloc", "libm"] } num = { version = "0.4", default-features = false, features = ["alloc", "libm"] }
num-complex = { version = "0.4", default-features = false } num-complex = { version = "0.4", default-features = false }
rand = { version = "0.8", default-features = false } rand = { version = "0.9", default-features = false }
rand_core = { version = "0.6", default-features = false } rand_core = { version = "0.9", default-features = false }
rand-utils = { version = "0.12", package = "winter-rand-utils", optional = true } rand-utils = { version = "0.12", package = "winter-rand-utils", optional = true }
rayon = { version = "1.10", optional = true } rayon = { version = "1.10", optional = true }
serde = { version = "1.0", default-features = false, optional = true, features = ["derive"] } serde = { version = "1.0", default-features = false, optional = true, features = ["derive"] }
@ -81,10 +81,10 @@ winter-utils = { version = "0.12", default-features = false }
[dev-dependencies] [dev-dependencies]
assert_matches = { version = "1.5", default-features = false } assert_matches = { version = "1.5", default-features = false }
criterion = { version = "0.5", features = ["html_reports"] } criterion = { version = "0.5", features = ["html_reports"] }
getrandom = { version = "0.2", features = ["js"] } getrandom = { version = "0.3", default-features = false }
hex = { version = "0.4", default-features = false, features = ["alloc"] } hex = { version = "0.4", default-features = false, features = ["alloc"] }
proptest = "1.6" proptest = { version = "1.6", default-features = false, features = ["alloc"]}
rand_chacha = { version = "0.3", default-features = false } rand_chacha = { version = "0.9", default-features = false }
rand-utils = { version = "0.12", package = "winter-rand-utils" } rand-utils = { version = "0.12", package = "winter-rand-utils" }
seq-macro = { version = "0.3" } seq-macro = { version = "0.3" }

2
config.toml Normal file
View file

@ -0,0 +1,2 @@
[target.wasm32-unknown-unknown]
rustflags = ['--cfg', 'getrandom_backend="wasm_js"']

View file

@ -10,7 +10,7 @@ cargo-fuzz = true
[dependencies] [dependencies]
libfuzzer-sys = "0.4" libfuzzer-sys = "0.4"
miden-crypto = { path = "..", features = ["concurrent"] } miden-crypto = { path = "..", features = ["concurrent"] }
rand = { version = "0.8", default-features = false } rand = { version = "0.9", default-features = false }
[[bin]] [[bin]]
name = "smt" name = "smt"

View file

@ -68,7 +68,7 @@ impl SecretKey {
pub fn new() -> Self { pub fn new() -> Self {
use rand::{rngs::StdRng, SeedableRng}; use rand::{rngs::StdRng, SeedableRng};
let mut rng = StdRng::from_entropy(); let mut rng = StdRng::from_os_rng();
Self::with_rng(&mut rng) Self::with_rng(&mut rng)
} }
@ -117,7 +117,7 @@ impl SecretKey {
pub fn sign(&self, message: Word) -> Signature { pub fn sign(&self, message: Word) -> Signature {
use rand::{rngs::StdRng, SeedableRng}; use rand::{rngs::StdRng, SeedableRng};
let mut rng = StdRng::from_entropy(); let mut rng = StdRng::from_os_rng();
self.sign_with_rng(message, &mut rng) self.sign_with_rng(message, &mut rng)
} }

View file

@ -100,14 +100,14 @@ pub(crate) fn sampler_z<R: Rng>(mu: f64, sigma: f64, sigma_min: f64, rng: &mut R
let r = mu - s; let r = mu - s;
let ccs = sigma_min * isigma; let ccs = sigma_min * isigma;
loop { loop {
let z0 = base_sampler(rng.gen()); let z0 = base_sampler(rng.random());
let random_byte: u8 = rng.gen(); let random_byte: u8 = rng.random();
let b = (random_byte & 1) as i16; let b = (random_byte & 1) as i16;
let z = b + ((b << 1) - 1) * z0; let z = b + ((b << 1) - 1) * z0;
let zf_min_r = (z as f64) - r; let zf_min_r = (z as f64) - r;
// x = ((z-r)^2)/(2*sigma^2) - ((z-b)^2)/(2*sigma0^2) // x = ((z-r)^2)/(2*sigma^2) - ((z-b)^2)/(2*sigma0^2)
let x = zf_min_r * zf_min_r * dss - (z0 * z0) as f64 * INV_2SIGMA_MAX_SQ; let x = zf_min_r * zf_min_r * dss - (z0 * z0) as f64 * INV_2SIGMA_MAX_SQ;
if ber_exp(x, ccs, rng.gen()) { if ber_exp(x, ccs, rng.random()) {
return z + (s as i16); return z + (s as i16);
} }
} }
@ -174,13 +174,6 @@ mod test {
*d = self.next(); *d = self.next();
} }
} }
fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), rand::Error> {
for d in dest.iter_mut() {
*d = self.next();
}
Ok(())
}
} }
#[test] #[test]

View file

@ -6,7 +6,7 @@ use miden_crypto::{
merkle::{MerkleError, Smt}, merkle::{MerkleError, Smt},
Felt, Word, EMPTY_WORD, ONE, Felt, Word, EMPTY_WORD, ONE,
}; };
use rand::{prelude::IteratorRandom, thread_rng, Rng}; use rand::{prelude::IteratorRandom, rng, Rng};
use rand_utils::rand_value; use rand_utils::rand_value;
#[derive(Parser, Debug)] #[derive(Parser, Debug)]
@ -141,7 +141,7 @@ pub fn batched_update(
println!("Running a batched update benchmark:"); println!("Running a batched update benchmark:");
let size = tree.num_leaves(); let size = tree.num_leaves();
let mut rng = thread_rng(); let mut rng = rng();
let new_pairs = let new_pairs =
entries entries
@ -149,10 +149,10 @@ pub fn batched_update(
.choose_multiple(&mut rng, updates) .choose_multiple(&mut rng, updates)
.into_iter() .into_iter()
.map(|(key, _)| { .map(|(key, _)| {
let value = if rng.gen_bool(REMOVAL_PROBABILITY) { let value = if rng.random_bool(REMOVAL_PROBABILITY) {
EMPTY_WORD EMPTY_WORD
} else { } else {
[ONE, ONE, ONE, Felt::new(rng.gen())] [ONE, ONE, ONE, Felt::new(rng.random())]
}; };
(key, value) (key, value)

View file

@ -5,7 +5,7 @@ use alloc::{
use assert_matches::assert_matches; use assert_matches::assert_matches;
use proptest::prelude::*; use proptest::prelude::*;
use rand::{prelude::IteratorRandom, thread_rng, Rng}; use rand::{prelude::IteratorRandom, rng, Rng};
use super::{ use super::{
build_subtree, InnerNode, NodeIndex, NodeMutations, PairComputations, RpoDigest, Smt, SmtLeaf, build_subtree, InnerNode, NodeIndex, NodeMutations, PairComputations, RpoDigest, Smt, SmtLeaf,
@ -114,7 +114,7 @@ fn generate_entries(pair_count: u64) -> Vec<(RpoDigest, Word)> {
fn generate_updates(entries: Vec<(RpoDigest, Word)>, updates: usize) -> Vec<(RpoDigest, Word)> { fn generate_updates(entries: Vec<(RpoDigest, Word)>, updates: usize) -> Vec<(RpoDigest, Word)> {
const REMOVAL_PROBABILITY: f64 = 0.2; const REMOVAL_PROBABILITY: f64 = 0.2;
let mut rng = thread_rng(); let mut rng = rng();
// Assertion to ensure input keys are unique // Assertion to ensure input keys are unique
assert!( assert!(
entries.iter().map(|(key, _)| key).collect::<BTreeSet<_>>().len() == entries.len(), entries.iter().map(|(key, _)| key).collect::<BTreeSet<_>>().len() == entries.len(),
@ -125,10 +125,10 @@ fn generate_updates(entries: Vec<(RpoDigest, Word)>, updates: usize) -> Vec<(Rpo
.choose_multiple(&mut rng, updates) .choose_multiple(&mut rng, updates)
.into_iter() .into_iter()
.map(|(key, _)| { .map(|(key, _)| {
let value = if rng.gen_bool(REMOVAL_PROBABILITY) { let value = if rng.random_bool(REMOVAL_PROBABILITY) {
EMPTY_WORD EMPTY_WORD
} else { } else {
[ONE, ONE, ONE, Felt::new(rng.gen())] [ONE, ONE, ONE, Felt::new(rng.random())]
}; };
(key, value) (key, value)
}) })
@ -381,11 +381,11 @@ fn test_multithreaded_subtrees() {
fn test_with_entries_concurrent() { fn test_with_entries_concurrent() {
const PAIR_COUNT: u64 = COLS_PER_SUBTREE * 64; const PAIR_COUNT: u64 = COLS_PER_SUBTREE * 64;
let mut entries = generate_entries(PAIR_COUNT); let mut entries = generate_entries(PAIR_COUNT);
let mut rng = rand::thread_rng(); let mut rng = rand::rng();
// Set 10% of the entries to have empty words as their values. // Set 10% of the entries to have empty words as their values.
for _ in 0..PAIR_COUNT / 10 { for _ in 0..PAIR_COUNT / 10 {
let random_index = rng.gen_range(0..PAIR_COUNT); let random_index = rng.random_range(0..PAIR_COUNT);
entries[random_index as usize].1 = EMPTY_WORD; entries[random_index as usize].1 = EMPTY_WORD;
} }

View file

@ -208,11 +208,6 @@ impl RngCore for RpoRandomCoin {
fn fill_bytes(&mut self, dest: &mut [u8]) { fn fill_bytes(&mut self, dest: &mut [u8]) {
impls::fill_bytes_via_next(self, dest) impls::fill_bytes_via_next(self, dest)
} }
fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), rand::Error> {
self.fill_bytes(dest);
Ok(())
}
} }
// SERIALIZATION // SERIALIZATION

View file

@ -206,11 +206,6 @@ impl RngCore for RpxRandomCoin {
fn fill_bytes(&mut self, dest: &mut [u8]) { fn fill_bytes(&mut self, dest: &mut [u8]) {
impls::fill_bytes_via_next(self, dest) impls::fill_bytes_via_next(self, dest)
} }
fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), rand::Error> {
self.fill_bytes(dest);
Ok(())
}
} }
// SERIALIZATION // SERIALIZATION