Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove dependence on Xorshift, ChaCha and Isaac crates #759

Merged
merged 2 commits into from Mar 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 3 additions & 4 deletions Cargo.toml
Expand Up @@ -50,11 +50,7 @@ rand_core = { path = "rand_core", version = "0.4" }
rand_pcg = { path = "rand_pcg", version = "0.1" }
rand_jitter = { path = "rand_jitter", version = "0.1" }
rand_os = { path = "rand_os", version = "0.1", optional = true }
# only for deprecations and benches:
rand_isaac = { path = "rand_isaac", version = "0.1" }
rand_chacha = { path = "rand_chacha", version = "0.1" }
rand_hc = { path = "rand_hc", version = "0.1" }
rand_xorshift = { path = "rand_xorshift", version = "0.1" }
log = { version = "0.4", optional = true }

[dependencies.packed_simd]
Expand All @@ -73,6 +69,9 @@ libc = { version = "0.2", default-features = false }
average = "0.9.2"
# Only for benches:
rand_xoshiro = { path = "rand_xoshiro", version = "0.1" }
rand_isaac = { path = "rand_isaac", version = "0.1" }
rand_chacha = { path = "rand_chacha", version = "0.1" }
rand_xorshift = { path = "rand_xorshift", version = "0.1" }

[build-dependencies]
autocfg = "0.1"
Expand Down
3 changes: 0 additions & 3 deletions src/lib.rs
Expand Up @@ -63,11 +63,8 @@ extern crate rand_jitter;
extern crate rand_os;

extern crate rand_core;
extern crate rand_isaac; // only for deprecations
extern crate rand_chacha; // only for deprecations
extern crate rand_hc;
extern crate rand_pcg;
extern crate rand_xorshift;

#[cfg(feature = "log")] #[macro_use] extern crate log;
#[allow(unused)]
Expand Down
8 changes: 4 additions & 4 deletions src/rngs/adapter/reseeding.rs
Expand Up @@ -79,7 +79,7 @@ use rand_core::block::{BlockRngCore, BlockRng};
/// # }
/// ```
///
/// [`ChaChaCore`]: rand_chacha::ChaChaCore
/// [`ChaChaCore`]: ../../../rand_chacha/struct.ChaChaCore.html
/// [`Hc128Core`]: rand_hc::Hc128Core
/// [`BlockRngCore`]: rand_core::block::BlockRngCore
/// [`ReseedingRng::new`]: ReseedingRng::new
Expand Down Expand Up @@ -336,14 +336,14 @@ mod fork {
#[cfg(test)]
mod test {
use {Rng, SeedableRng};
use rand_chacha::ChaChaCore;
use rand_hc::Hc128Core;
use rngs::mock::StepRng;
use super::ReseedingRng;

#[test]
fn test_reseeding() {
let mut zero = StepRng::new(0, 0);
let rng = ChaChaCore::from_rng(&mut zero).unwrap();
let rng = Hc128Core::from_rng(&mut zero).unwrap();
let mut reseeding = ReseedingRng::new(rng, 32*4, zero);

// Currently we only support for arrays up to length 32.
Expand All @@ -361,7 +361,7 @@ mod test {
#[test]
fn test_clone_reseeding() {
let mut zero = StepRng::new(0, 0);
let rng = ChaChaCore::from_rng(&mut zero).unwrap();
let rng = Hc128Core::from_rng(&mut zero).unwrap();
let mut rng1 = ReseedingRng::new(rng, 32*4, zero);

let first: u32 = rng1.gen();
Expand Down
4 changes: 2 additions & 2 deletions src/rngs/mod.rs
Expand Up @@ -56,7 +56,7 @@
//! the [`prng`][crate::prng] module, as well as in several other crates. For example, you
//! may wish a CSPRNG with significantly lower memory usage than [`StdRng`]
//! while being less concerned about performance, in which case [`ChaChaRng`]
//! is a good choice.
//! (from the `rand_chacha` crate) is a good choice.
//!
//! One complexity is that the internal state of a PRNG must change with every
//! generated number. For APIs this generally means a mutable reference to the
Expand Down Expand Up @@ -144,7 +144,7 @@
//! [`mock::StepRng`]: rngs::mock::StepRng
//! [`adapter::ReadRng`]: rngs::adapter::ReadRng
//! [`adapter::ReseedingRng`]: rngs::adapter::ReseedingRng
//! [`ChaChaRng`]: rand_chacha::ChaChaRng
//! [`ChaChaRng`]: ../../rand_chacha/struct.ChaChaRng.html

pub mod adapter;

Expand Down
2 changes: 1 addition & 1 deletion src/rngs/std.rs
Expand Up @@ -26,7 +26,7 @@ use rand_hc::Hc128Rng;
/// [rand_chacha] crate.
///
/// [HC-128]: rand_hc::Hc128Rng
/// [`ChaChaRng`]: rand_chacha::ChaChaRng
/// [`ChaChaRng`]: ../../rand_chacha/struct.ChaChaRng.html
/// [rand_hc]: https://crates.io/crates/rand_hc
/// [rand_chacha]: https://crates.io/crates/rand_chacha
#[derive(Clone, Debug)]
Expand Down