Update dependencies

This commit is contained in:
Vinzent Steinberg 2019-07-08 16:01:13 +02:00
parent 2c2632a564
commit 3326a8bb9c
4 changed files with 19 additions and 16 deletions

View File

@ -38,8 +38,9 @@ version = "0.3"
[dev-dependencies]
bencher = "0.1"
rand = "0.6"
rand_xoshiro = "0.1"
rand = "0.7"
rand_xoshiro = "0.3"
rand_distr = "0.2"
serde_json = "1"
streaming-stats = "0.2"
quantiles = "0.7"

View File

@ -2,6 +2,8 @@
extern crate core;
extern crate rand;
extern crate rand_xoshiro;
extern crate rand_distr;
#[cfg(feature = "serde1")]
#[macro_use] extern crate serde_derive;
#[cfg(feature = "serde1")]
@ -10,8 +12,8 @@ extern crate serde_json;
#[macro_use] extern crate serde_big_array;
use core::iter::Iterator;
use rand::distributions::Distribution;
use rand::FromEntropy;
use rand::SeedableRng;
use rand_distr::Distribution;
use average::{Histogram, Merge};
@ -197,8 +199,8 @@ fn mul() {
#[test]
fn variance() {
let mut h = Histogram10::with_const_width(-3., 3.);
let normal = rand::distributions::Normal::new(0., 1.);
let mut rng = rand::rngs::SmallRng::from_entropy();
let normal = rand_distr::Normal::new(0., 1.).unwrap();
let mut rng = rand_xoshiro::Xoshiro256StarStar::from_entropy();
for _ in 0..1000000 {
let _ = h.add(normal.sample(&mut rng));
}

View File

@ -3,15 +3,15 @@
#[macro_use] extern crate average;
extern crate rand;
extern crate rand_distr;
use rand::distributions::Distribution;
use rand_distr::Distribution;
use average::{Kurtosis, Estimate};
#[test]
fn normal_distribution() {
use rand::distributions::Normal;
let normal = Normal::new(2.0, 3.0);
let normal = rand_distr::Normal::new(2.0, 3.0).unwrap();
let mut a = Kurtosis::new();
for _ in 0..1_000_000 {
a.add(normal.sample(&mut ::rand::thread_rng()));
@ -26,9 +26,8 @@ fn normal_distribution() {
#[test]
fn exponential_distribution() {
use rand::distributions::Exp;
let lambda = 2.0;
let normal = Exp::new(lambda);
let normal = rand_distr::Exp::new(lambda).unwrap();
let mut a = Kurtosis::new();
for _ in 0..6_000_000 {
a.add(normal.sample(&mut ::rand::thread_rng()));

View File

@ -3,17 +3,18 @@
#[macro_use] extern crate average;
extern crate rand;
extern crate rand_xoshiro;
extern crate rand_distr;
extern crate stats;
/// Create a random vector by sampling from a normal distribution.
fn initialize_vec(size: usize) -> Vec<f64> {
use rand::distributions::{Normal, Distribution};
use rand_distr::{Normal, Distribution};
use rand_xoshiro::Xoshiro256StarStar;
use rand::SeedableRng;
use rand::rngs::SmallRng;
let normal = Normal::new(2.0, 3.0);
let normal = Normal::new(2.0, 3.0).unwrap();
let mut values = Vec::with_capacity(size);
let mut rng = SmallRng::from_seed(
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]);
let mut rng = Xoshiro256StarStar::seed_from_u64(42);
for _ in 0..size {
values.push(normal.sample(&mut rng));
}