diff --git a/src/distributions/bernoulli.rs b/src/distributions/bernoulli.rs index ff5f1acc..e3ccf965 100644 --- a/src/distributions/bernoulli.rs +++ b/src/distributions/bernoulli.rs @@ -79,14 +79,13 @@ impl Distribution for Bernoulli { #[cfg(test)] mod test { - use rngs::SmallRng; - use {Rng, FromEntropy}; + use Rng; use distributions::Distribution; use super::Bernoulli; #[test] fn test_trivial() { - let mut r = SmallRng::from_entropy(); + let mut r = ::test::rng(1); let always_false = Bernoulli::new(0.0); let always_true = Bernoulli::new(1.0); for _ in 0..5 { @@ -104,7 +103,7 @@ mod test { const N: u32 = 10_000_000; let mut sum: u32 = 0; - let mut rng = SmallRng::from_entropy(); + let mut rng = ::test::rng(2); for _ in 0..N { if d.sample(&mut rng) { sum += 1; diff --git a/tests/bool.rs b/tests/bool.rs index e0d8c3bf..c4208a00 100644 --- a/tests/bool.rs +++ b/tests/bool.rs @@ -2,8 +2,8 @@ extern crate rand; +use rand::SeedableRng; use rand::rngs::SmallRng; -use rand::FromEntropy; use rand::distributions::{Distribution, Bernoulli}; /// This test should make sure that we don't accidentally have undefined @@ -15,7 +15,8 @@ fn large_probability() { let p = 1. - ::core::f64::EPSILON / 2.; assert!(p < 1.); let d = Bernoulli::new(p); - let mut rng = SmallRng::from_entropy(); + let mut rng = SmallRng::from_seed( + [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]); for _ in 0..10 { assert!(d.sample(&mut rng), "extremely unlikely to fail by accident"); }