commit | 244e3e874d6d90830774e783c19743e8e8fe4d21 | [log] [tgz] |
---|---|---|
author | Joel Galenson <[email protected]> | Tue Aug 24 18:23:59 2021 +0000 |
committer | Automerger Merge Worker <[email protected]> | Tue Aug 24 18:23:59 2021 +0000 |
tree | 579fc80bed4acb6ab507623e325efd82f3403d9b | |
parent | 6682ab449a1d4ff3917a3d808a0f3e7ad31af6b5 [diff] | |
parent | f8f88555e3c31b3501457804cfaf1c01cb4d3824 [diff] |
Update TEST_MAPPING am: f8f88555e3 Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/getrandom/+/1806156 Change-Id: Ifc2f8dc5982d6e0313512635ad33e6c73d8cbc9e
A Rust library for retrieving random data from (operating) system source. It is assumed that system always provides high-quality cryptographically secure random data, ideally backed by hardware entropy sources. This crate derives its name from Linux‘s getrandom
function, but is cross platform, roughly supporting the same set of platforms as Rust’s std
lib.
This is a low-level API. Most users should prefer using high-level random-number library like rand
.
Add this to your Cargo.toml
:
[dependencies] getrandom = "0.2"
Then invoke the getrandom
function:
fn get_random_buf() -> Result<[u8; 32], getrandom::Error> { let mut buf = [0u8; 32]; getrandom::getrandom(&mut buf)?; Ok(buf) }
For more information about supported targets, entropy sources, no_std
targets, crate features, WASM support and Custom RNGs see the getrandom
documentation and getrandom::Error
documentation.
This crate requires Rust 1.34.0 or later.
The getrandom
library is distributed under either of
at your option.