rand_otp 0.1.0

Pregenerated random numbers.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# One Time Pad for rand.

[Docs](https://docs.rs/rand_otp)

This is useful when you want to control the sequence of generated numbers. One example use case is for fuzz-testing programs that pull values from a RNG. Using a PRNG would result in basically brute-force fuzzing while using `rand_otp` allows guided-fuzzing to be effective.

```rust
let buf = [1, 2, 3, 4];
let mut rng = Otp::new(&buf[..]);
assert_eq!(rng.next_u32(), 0x04030201);
```

```rust
// Read random values from a file (or from a random device).
let f = std::fs::File::open("/dev/urandom").unwrap();
let mut rng = Otp::new(f);
eprintln!("Random: {}", rng.next_u64());
```