Struct rand::read::ReadRng
[-] [+]
[src]
pub struct ReadRng<R> { // some fields omitted }
An RNG that reads random bytes straight from a Read
. This will
work best with an infinite reader, but this is not required.
Panics
It will panic if it there is insufficient data to fulfill a request.
Example
use rand::{read, Rng}; let data = vec![1, 2, 3, 4, 5, 6, 7, 8]; let mut rng = read::ReadRng::new(&data[..]); println!("{:x}", rng.gen::<u32>());