Skip to content

Commit

Permalink
Merge pull request #196 from dhardy/up-jitter
Browse files Browse the repository at this point in the history
Switch backup entropy generator to JitterRng
  • Loading branch information
dhardy authored Dec 1, 2017
2 parents 821acdf + fdaab7e commit 48e4e6f
Show file tree
Hide file tree
Showing 6 changed files with 773 additions and 16 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ matrix:
- rust: beta
- rust: nightly
script:
- cargo bench
- cargo test
- cargo test --features nightly
- cargo test --manifest-path rand-derive/Cargo.toml
Expand Down
1 change: 1 addition & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ install:
build: false

test_script:
- cargo bench
- cargo test
- cargo test --features nightly
- cargo test --manifest-path rand-derive/Cargo.toml
11 changes: 10 additions & 1 deletion benches/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,18 @@ mod distributions;

use std::mem::size_of;
use test::{black_box, Bencher};
use rand::{XorShiftRng, StdRng, IsaacRng, Isaac64Rng, Rng};
use rand::{XorShiftRng, StdRng, IsaacRng, Isaac64Rng, JitterRng, Rng};
use rand::{OsRng, sample, weak_rng};

#[bench]
fn rand_jitter(b: &mut Bencher) {
let mut rng = JitterRng::new().unwrap();
b.iter(|| {
black_box(rng.next_u64());
});
b.bytes = size_of::<u64>() as u64;
}

#[bench]
fn rand_xorshift(b: &mut Bencher) {
let mut rng: XorShiftRng = OsRng::new().unwrap().gen();
Expand Down
Loading

0 comments on commit 48e4e6f

Please sign in to comment.