12 unstable releases (5 breaking)
|0.5.0||Jun 6, 2019|
|0.4.0||Jan 25, 2019|
|0.3.0||Sep 24, 2018|
|0.2.1||Jun 8, 2018|
#3 in Algorithms
782,093 downloads per month
Used in 8,960 crates (50 directly)
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
The current version is:
rand_core = "0.5.0"
Rand libs have inter-dependencies and make use of the
semver trick in order to make traits
compatible across crate versions. (This is especially important for
SeedableRng.) A few crate releases are thus compatibility shims,
depending on the next lib version (e.g.
0.3.1). This means, for example, that
rand_core_0_3_0::SeedableRng are distinct, incompatible traits, which can
cause build errors. Usually, running
cargo update is enough to fix any issues.
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
std::io::Read support for types supporting
extensions to the
Error type's functionality.
std feature is not enabled by default. This is primarily to avoid build
problems where one crate implicitly requires
std support and
another crate requires
std support. However, the
continues to enable
std support by default, both for itself and
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).