Skip to content

Commit

Permalink
Add HC-128 RNG
Browse files Browse the repository at this point in the history
  • Loading branch information
pitdicker committed Jan 2, 2018
1 parent d4c73e2 commit 2fb08f4
Show file tree
Hide file tree
Showing 4 changed files with 547 additions and 1 deletion.
6 changes: 5 additions & 1 deletion benches/generators.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use std::mem::size_of;
use test::{black_box, Bencher};

use rand::{Rng, StdRng, OsRng, JitterRng};
use rand::{XorShiftRng, IsaacRng, Isaac64Rng, ChaChaRng};
use rand::{XorShiftRng, Hc128Rng, IsaacRng, Isaac64Rng, ChaChaRng};

macro_rules! gen_bytes {
($fnn:ident, $gen:ident) => {
Expand Down Expand Up @@ -47,6 +47,7 @@ macro_rules! gen_bytes_new {
}

gen_bytes!(gen_bytes_xorshift, XorShiftRng);
gen_bytes!(gen_bytes_hc128, Hc128Rng);
gen_bytes!(gen_bytes_isaac, IsaacRng);
gen_bytes!(gen_bytes_isaac64, Isaac64Rng);
gen_bytes!(gen_bytes_chacha, ChaChaRng);
Expand Down Expand Up @@ -85,13 +86,15 @@ macro_rules! gen_uint_new {
}

gen_uint!(gen_u32_xorshift, u32, XorShiftRng);
gen_uint!(gen_u32_hc128, u32, Hc128Rng);
gen_uint!(gen_u32_isaac, u32, IsaacRng);
gen_uint!(gen_u32_isaac64, u32, Isaac64Rng);
gen_uint!(gen_u32_chacha, u32, ChaChaRng);
gen_uint_new!(gen_u32_std, u32, StdRng);
gen_uint_new!(gen_u32_os, u32, OsRng);

gen_uint!(gen_u64_xorshift, u64, XorShiftRng);
gen_uint!(gen_u64_hc128, u64, Hc128Rng);
gen_uint!(gen_u64_isaac, u64, IsaacRng);
gen_uint!(gen_u64_isaac64, u64, Isaac64Rng);
gen_uint!(gen_u64_chacha, u64, ChaChaRng);
Expand Down Expand Up @@ -121,6 +124,7 @@ macro_rules! init_gen {
}

init_gen!(init_xorshift, XorShiftRng);
init_gen!(init_hc128, Hc128Rng);
init_gen!(init_isaac, IsaacRng);
init_gen!(init_isaac64, Isaac64Rng);
init_gen!(init_chacha, ChaChaRng);
Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ use distributions::{Range, IndependentSample};
use distributions::range::SampleRange;

pub use prng::XorShiftRng;
pub use prng::Hc128Rng;

pub mod distributions;
pub mod reseeding;
Expand Down
Loading

0 comments on commit 2fb08f4

Please sign in to comment.