Crates.io | rand-facade |
lib.rs | rand-facade |
version | 0.2.0 |
source | src |
created_at | 2020-07-03 04:07:15.614708 |
updated_at | 2020-07-06 05:55:43.475858 |
description | A global mutex-based random facade for no_std compatible libraries that require an initialised random number generator |
homepage | |
repository | https://github.com/ryankurte/rust-rand-facade |
max_upload_size | |
id | 260846 |
size | 10,673 |
An experimental global facade for rand::RngCore
to support use of initialised random number generators in no_std
capable libraries and projects, without needing to specify a given random generator within the library.
This allows you to initialise and maintain a physical Random Number Generator (RNG) on no_std
platforms, while allowing the sharing a global RNG (if required) or falling through to the default OsRng
on std
platforms.
This is intended to be used as a dependency for relevant libraries / projects that require RNGs, and allows modes to be swapped using the feature flags described below.
Include by adding rand-facade = "0.1.0"
to your Cargo.toml
.
os_rng
disables binding and falls through to the default rand::rng::OsRng
, this is a sensible default for most appsstd
enables global Rng
binding using std::sync::Mutex
cortex_m
enables global Rng
binding using cortex_m::Mutex
This is a work in progress! Currently this works with std
and cortex-m
platforms.