diff --git a/src/rngs/adapter/read.rs b/src/rngs/adapter/read.rs index a6ab6f55..b0bfd7a5 100644 --- a/src/rngs/adapter/read.rs +++ b/src/rngs/adapter/read.rs @@ -15,10 +15,14 @@ use std::io::Read; use rand_core::{RngCore, Error, ErrorKind, impls}; -/// An RNG that reads random bytes straight from a `Read`. +/// An RNG that reads random bytes straight from any type supporting +/// `std::io::Read`, for example files. /// /// This will work best with an infinite reader, but that is not required. /// +/// This can be used with `/dev/urandom` on Unix but it is recommended to use +/// [`OsRng`] instead. +/// /// # Panics /// /// `ReadRng` uses `std::io::read_exact`, which retries on interrupts. All other @@ -35,6 +39,8 @@ use rand_core::{RngCore, Error, ErrorKind, impls}; /// let mut rng = read::ReadRng::new(&data[..]); /// println!("{:x}", rng.gen::()); /// ``` +/// +/// [`OsRng`]: ../struct.OsRng.html #[derive(Debug)] pub struct ReadRng { reader: R