Expand description
Capability-based random number generators
This corresponds to rand.
Capability-based APIs represent access to external resources as values which can be passed around between different parts of a program.
Two notable features are the OsRng and CapRng types, which
wrap up access to the operating system entropy source in capability
values.
This crate uses the existing rand::SeedableRng trait rather than having
its own version, however while rand::SeedableRng is mostly just a pure
interface, it provides a from_entropy function which directly reads
from the operating system entropy source. To preserve the
capability-based interface, avoid using rand::SeedableRng’s
from_entropy function on any of the types that implement that trait; use
[std_rng_from_entropy] instead.
Re-exports§
pub use rand::rand_core;
Modules§
- distr
- Generating random samples from probability distributions
- prelude
- Convenience re-export of common members.
- rngs
- Random number generators and adapters.
- seq
- Sequence-related functionality
Structs§
- Ambient
Authority - Instances of this
AmbientAuthoritytype serve to indicate that theambient_authorityfunction has been called, indicating that the user has explicitly opted into using ambient authority.
Traits§
- Crypto
Rng - A marker trait over
RngCorefor securely unpredictable RNGs - Fill
- Types which may be filled with random data
- Rng
- User-level interface for RNGs
- RngCore
- Implementation-level interface for RNGs
- Seedable
Rng - A random number generator that can be explicitly seeded.
- TryCrypto
Rng - A marker trait over
TryRngCorefor securely unpredictable RNGs - TryRng
Core - A potentially fallible variant of
RngCore
Functions§
- ambient_
authority - Return an
AmbientAuthorityvalue, which allows use of functions that include anAmbientAuthorityargument. - random
- Generates a random value using the thread-local random number generator.
- std_
rng_ from_ os_ rng - Retrieve the standard random number generator, seeded by the system.
- thread_
rng - Retrieve the lazily-initialized thread-local random number generator, seeded by the system.