Skip to content

Commit

Permalink
Fix big_rand ci
Browse files Browse the repository at this point in the history
  • Loading branch information
Gelbpunkt committed Jan 5, 2021
1 parent e44d561 commit 42ff822
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
8 changes: 4 additions & 4 deletions ci/big_rand/Cargo.toml
Expand Up @@ -6,14 +6,14 @@ 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"]
path = "../.."

[dependencies.rand]
features = ["small_rng"]
version = "0.7"
version = "0.8"
4 changes: 2 additions & 2 deletions ci/big_rand/src/lib.rs
Expand Up @@ -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};

Expand Down Expand Up @@ -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 {
Expand Down
9 changes: 6 additions & 3 deletions ci/big_rand/src/torture.rs
Expand Up @@ -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)
}

Expand All @@ -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);
Expand Down

0 comments on commit 42ff822

Please sign in to comment.