Struct rand::reader::ReaderRng
[-] [+]
[src]
pub struct ReaderRng<R> { // some fields omitted }
An RNG that reads random bytes straight from a Reader
. 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::{reader, Rng}; use std::old_io::MemReader; let mut rng = reader::ReaderRng::new(MemReader::new(vec!(1,2,3,4,5,6,7,8))); println!("{:x}", rng.gen::<u32>());