Function getrandom
pub fn getrandom(buf: &mut [u8], flags: GetRandomFlags) -> Result<usize, Errno> ⓘ
Available on crate feature
dep_rustix
only.Expand description
getrandom(buf, flags)
—Reads a sequence of random bytes.
This is a very low-level API which may be difficult to use correctly. Most
users should prefer to use getrandom
or rand
APIs instead.
This takes a &mut [u8]
which Rust requires to contain initialized memory.
To use an uninitialized buffer, use getrandom_uninit
.