Function getrandom
pub unsafe fn getrandom(buf: &mut [u8], flags: u32) -> Result<isize, i32> ⓘ
Available on crate feature
dep_nc
only.Expand description
Obtain a series of random bytes.
§Examples
let mut buf = [0_u8; 32];
let ret = unsafe { nc::getrandom(&mut buf, 0) };
assert!(ret.is_ok());
let size = ret.unwrap() as usize;
assert!(size <= buf.len());