From 28176b444aaee3031a66c1baf4bdf2f46c4e83aa Mon Sep 17 00:00:00 2001 From: Jens Reidel Date: Tue, 5 Jan 2021 22:57:41 +0100 Subject: [PATCH] Fix big_rand ci --- ci/big_rand/Cargo.toml | 8 ++++---- ci/big_rand/src/lib.rs | 4 ++-- ci/big_rand/src/torture.rs | 9 ++++++--- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/ci/big_rand/Cargo.toml b/ci/big_rand/Cargo.toml index 199c022e..33dd20bc 100644 --- a/ci/big_rand/Cargo.toml +++ b/ci/big_rand/Cargo.toml @@ -6,9 +6,9 @@ edition = "2018" [dependencies] num-traits = "0.2.11" -rand_chacha = "0.2" -rand_isaac = "0.2" -rand_xorshift = "0.2" +rand_chacha = "0.3" +rand_isaac = "0.3" +rand_xorshift = "0.3" [dependencies.num-bigint] features = ["rand"] @@ -16,4 +16,4 @@ path = "../.." [dependencies.rand] features = ["small_rng"] -version = "0.7" +version = "0.8" diff --git a/ci/big_rand/src/lib.rs b/ci/big_rand/src/lib.rs index 1bea5750..69728777 100644 --- a/ci/big_rand/src/lib.rs +++ b/ci/big_rand/src/lib.rs @@ -11,7 +11,7 @@ mod torture; mod biguint { use num_bigint::{BigUint, RandBigInt, RandomBits}; use num_traits::Zero; - use rand::distributions::Uniform; + use rand::distributions::{Distribution, Uniform}; use rand::thread_rng; use rand::{Rng, SeedableRng}; @@ -192,7 +192,7 @@ mod biguint { let mut rng = thread_rng(); let bit_range = Uniform::new(0, 2048); - let sample_bits: Vec<_> = rng.sample_iter(&bit_range).take(100).collect(); + let sample_bits: Vec<_> = bit_range.sample_iter(&mut rng).take(100).collect(); for bits in sample_bits { let x = rng.gen_biguint(bits); for n in 2..11 { diff --git a/ci/big_rand/src/torture.rs b/ci/big_rand/src/torture.rs index 746128de..eac8c222 100644 --- a/ci/big_rand/src/torture.rs +++ b/ci/big_rand/src/torture.rs @@ -4,7 +4,10 @@ use rand::prelude::*; use rand::rngs::SmallRng; fn get_rng() -> SmallRng { - let seed = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]; + let seed = [ + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, + 26, 27, 28, 29, 30, 31, 32, + ]; SmallRng::from_seed(seed) } @@ -14,8 +17,8 @@ fn test_mul_divide_torture_count(count: usize) { for _ in 0..count { // Test with numbers of random sizes: - let xbits = rng.gen_range(0, bits_max); - let ybits = rng.gen_range(0, bits_max); + let xbits = rng.gen_range(0..bits_max); + let ybits = rng.gen_range(0..bits_max); let x = rng.gen_biguint(xbits); let y = rng.gen_biguint(ybits);