[][src]Crate cap_rand

Capability-oriented random number generators

This corresponds to rand.

Capability-oriented APIs represent access to external resources as objects 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 objects.

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-oriented interface, avoid using rand::SeedableRng's from_entropy function on any of the types that implement that trait. rand: https://docs.rs/rand/current/rand/index.html [OsRng]: rngs/struct.OsRng.html [CapRng]: rngs/struct.CapRng.html

Modules

distributions

Generating random samples from probability distributions

prelude

Convenience re-export of common members.

rngs

Random number generators and adapters.

seq

Sequence-related functionality

Structs

Error

Error type of random number generators

Traits

AsByteSliceMut

Trait for casting types to byte slices

CryptoRng

A marker trait used to indicate that an RngCore or BlockRngCore implementation is supposed to be cryptographically secure.

Rng

An automatically-implemented extension trait on RngCore providing high-level generic methods for sampling values and other convenience methods.

RngCore

The core of a random number generator.

SeedableRng

A random number generator that can be explicitly seeded.

Functions

random

Generates a random value using the thread-local random number generator.

thread_rng

Retrieve the lazily-initialized thread-local random number generator, seeded by the system.