Skip to main content

bytes

Function bytes 

Source
pub fn bytes(length: usize) -> Vec<u8> ⓘ
Expand description

Fill a buffer with length bytes from the operating system’s CSPRNG.

Reading /dev/urandom directly keeps the dependency list honest — it is the same syscall a rand crate would make. If it is unreachable (a chroot without /dev, a platform without it) the caller still gets bytes, but they are only unique, not unpredictable, and the process says so.