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());