tree: cbe5104a6218faa1c36b832abf10a851c5b4ca0f [path history] [tgz]
  1. src/
  2. .cargo-checksum.json
  3. Cargo.toml
  4. CHANGELOG.md
  5. COPYRIGHT
  6. LICENSE-APACHE
  7. LICENSE-MIT
  8. README.md
third_party/rust_crates/vendor/rand_core-0.4.0/README.md

rand_core

Build Status Build Status Latest version Book API API Minimum rustc version

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, RngCore; it 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.

Links:

Functionality

The 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 rand.

Crate Features

rand_core supports no_std and alloc-only configurations, as well as full std functionality. The differences between no_std and full std are small, comprising RngCore support for Box<R> types where R: RngCore, std::io::Read support for types supporting RngCore, and extensions to the Error type's functionality.

The std feature is not enabled by default. This is primarily to avoid build problems where one crate implicitly requires rand_core with std support and another crate requires rand without std support. However, the rand crate continues to enable std support by default, both for itself and rand_core.

The serde1 feature can be used to derive Serialize and Deserialize for RNG implementations that use the BlockRng or BlockRng64 wrappers.

License

rand_core is distributed under the terms of both the MIT license and the Apache License (Version 2.0).

See LICENSE-APACHE and LICENSE-MIT, and COPYRIGHT for details.