Core traits and error types of the rand library, plus tools for implementing RNGs.
This crate is intended for use when implementing the core trait,
defines the core traits to be implemented as well as several small functions to
aid in their implementation and types required for error handling.
The main rand crate re-exports most items defined in this crate, along with
tools to convert the integer samples generated by
RngCore to many different
applications (including sampling from restricted ranges, conversion to floating
point, list permutations and secure initialisation of RNGs). Most users should
prefer to use the main rand crate.
rand_core crate provides:
- base random number generator traits
- error-reporting types
- functionality to aid implementation of RNGs
The traits and error types are also available via
alloc-only configurations, as well as full
std functionality. The differences between
no_std and full
std are small,
RngCore support for
Box<R> types where
R: RngCore, as well as
extensions to the
Error type's functionality.
Due to rust-lang/cargo#1596,
rand_core is built without
std support by default. Since features are
unioned across the whole dependency tree, any crate using
rand with its
default features will also enable
std support in
serde1 feature can be used to derive
Deserialize for RNG
implementations that use the
rand_core is distributed under the terms of both the MIT license and the
Apache License (Version 2.0).