1 2 3 4 5 6 7 8 9 10 11 12 13
use core::ffi::c_void; extern "C" { fn arc4random_buf(buf: *mut c_void, nbytes: usize); } /// Obtain a series of random bytes. pub fn entropy(out: &mut [u8]) -> bool { unsafe { arc4random_buf(out.as_mut_ptr() as *mut c_void, out.len()); true } }