]>
git.proxmox.com Git - rustc.git/blob - vendor/rustix/src/rand/getrandom.rs
1 use crate::{backend, io}
;
3 /// `GRND_*` constants for use with `getrandom`.
4 pub use backend
::rand
::types
::GetRandomFlags
;
6 /// `getrandom(buf, flags)`—Reads a sequence of random bytes.
8 /// This is a very low-level API which may be difficult to use correctly. Most
9 /// users should prefer to use [`getrandom`] or [`rand`] APIs instead.
11 /// [`getrandom`]: https://crates.io/crates/getrandom
12 /// [`rand`]: https://crates.io/crates/rand
17 /// [Linux]: https://man7.org/linux/man-pages/man2/getrandom.2.html
19 pub fn getrandom(buf
: &mut [u8], flags
: GetRandomFlags
) -> io
::Result
<usize> {
20 backend
::rand
::syscalls
::getrandom(buf
, flags
)