Skip to content

Commit 48e4e6f

Browse files
authored
Merge pull request #196 from dhardy/up-jitter
Switch backup entropy generator to JitterRng
2 parents 821acdf + fdaab7e commit 48e4e6f

File tree

6 files changed

+773
-16
lines changed

6 files changed

+773
-16
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ matrix:
1212
- rust: beta
1313
- rust: nightly
1414
script:
15+
- cargo bench
1516
- cargo test
1617
- cargo test --features nightly
1718
- cargo test --manifest-path rand-derive/Cargo.toml

appveyor.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ install:
3232
build: false
3333

3434
test_script:
35+
- cargo bench
3536
- cargo test
3637
- cargo test --features nightly
3738
- cargo test --manifest-path rand-derive/Cargo.toml

benches/bench.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,18 @@ mod distributions;
99

1010
use std::mem::size_of;
1111
use test::{black_box, Bencher};
12-
use rand::{XorShiftRng, StdRng, IsaacRng, Isaac64Rng, Rng};
12+
use rand::{XorShiftRng, StdRng, IsaacRng, Isaac64Rng, JitterRng, Rng};
1313
use rand::{OsRng, sample, weak_rng};
1414

15+
#[bench]
16+
fn rand_jitter(b: &mut Bencher) {
17+
let mut rng = JitterRng::new().unwrap();
18+
b.iter(|| {
19+
black_box(rng.next_u64());
20+
});
21+
b.bytes = size_of::<u64>() as u64;
22+
}
23+
1524
#[bench]
1625
fn rand_xorshift(b: &mut Bencher) {
1726
let mut rng: XorShiftRng = OsRng::new().unwrap().gen();

0 commit comments

Comments
 (0)