diff --git a/Cargo.toml b/Cargo.toml index a4cf210..b67c82e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -40,6 +40,7 @@ version = "0.3" [dev-dependencies] bencher = "0.1" rand = "0.6" +rand_xoshiro = "0.1" serde_json = "1" streaming-stats = "0.2" quantiles = "0.7" diff --git a/benches/kurtosis.rs b/benches/kurtosis.rs index 3ec4fe4..d82bef4 100644 --- a/benches/kurtosis.rs +++ b/benches/kurtosis.rs @@ -2,6 +2,7 @@ #[macro_use] extern crate bencher; extern crate rand; +extern crate rand_xoshiro; extern crate average; @@ -10,12 +11,13 @@ use bencher::Bencher; /// Create a random vector by sampling from a normal distribution. fn initialize_vec() -> Vec { use rand::distributions::{Normal, Distribution}; - use rand::{XorShiftRng, SeedableRng}; + use rand::SeedableRng; let normal = Normal::new(2.0, 3.0); let n = 1_000_000; let mut values = Vec::with_capacity(n); - let mut rng = XorShiftRng::from_seed( - [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]); + let mut rng = rand_xoshiro::Xoshiro256StarStar::from_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]); for _ in 0..n { values.push(normal.sample(&mut rng)); } diff --git a/benches/mean.rs b/benches/mean.rs index eb9d8ed..25dc469 100644 --- a/benches/mean.rs +++ b/benches/mean.rs @@ -2,6 +2,7 @@ #[macro_use] extern crate bencher; extern crate rand; +extern crate rand_xoshiro; extern crate average; extern crate stats; @@ -11,12 +12,13 @@ use bencher::Bencher; /// Create a random vector by sampling from a normal distribution. fn initialize_vec() -> Vec { use rand::distributions::{Normal, Distribution}; - use rand::{XorShiftRng, SeedableRng}; + use rand::SeedableRng; let normal = Normal::new(2.0, 3.0); let n = 1_000_000; let mut values = Vec::with_capacity(n); - let mut rng = XorShiftRng::from_seed( - [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]); + let mut rng = rand_xoshiro::Xoshiro256StarStar::from_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]); for _ in 0..n { values.push(normal.sample(&mut rng)); } diff --git a/benches/min.rs b/benches/min.rs index c508121..eb90e22 100644 --- a/benches/min.rs +++ b/benches/min.rs @@ -2,6 +2,7 @@ #[macro_use] extern crate bencher; extern crate rand; +extern crate rand_xoshiro; extern crate average; extern crate stats; @@ -10,13 +11,14 @@ use bencher::Bencher; /// Create a random vector of random floats in [0, 1]. fn initialize_vec() -> Vec { - use rand::distributions::{Range, Distribution}; - use rand::{XorShiftRng, SeedableRng}; - let range = Range::new(0.0, 1.0); + use rand::distributions::{Uniform, Distribution}; + use rand::SeedableRng; + let range = Uniform::new(0.0, 1.0); let n = 1_000_000; let mut values = Vec::with_capacity(n); - let mut rng = XorShiftRng::from_seed( - [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]); + let mut rng = rand_xoshiro::Xoshiro256StarStar::from_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]); for _ in 0..n { values.push(range.sample(&mut rng)); }