2018-03-25 09:27:25 +02:00
|
|
|
# rand_core
|
|
|
|
|
2018-08-13 18:00:37 +01:00
|
|
|
[](https://travis-ci.org/rust-random/rand)
|
2018-09-25 14:19:37 +01:00
|
|
|
[](https://ci.appveyor.com/project/rust-random/rand)
|
2018-03-27 10:44:20 +02:00
|
|
|
[](https://crates.io/crates/rand_core)
|
2018-11-22 19:27:08 +00:00
|
|
|
[](https://rust-random.github.io/book/)
|
|
|
|
[](https://rust-random.github.io/rand/rand_core)
|
|
|
|
[](https://docs.rs/rand_core)
|
|
|
|
[](https://github.com/rust-random/rand#rust-version-requirements)
|
2018-03-08 11:54:13 +00:00
|
|
|
|
2018-03-09 09:55:49 +00:00
|
|
|
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.
|
2018-03-08 11:54:13 +00:00
|
|
|
|
2018-11-22 19:27:08 +00:00
|
|
|
Links:
|
2018-03-25 09:27:25 +02:00
|
|
|
|
2018-11-22 19:27:08 +00:00
|
|
|
- [API documentation (master)](https://rust-random.github.io/rand/rand_core)
|
|
|
|
- [API documentation (docs.rs)](https://docs.rs/rand_core)
|
|
|
|
- [Changelog](CHANGELOG.md)
|
2018-03-08 11:54:13 +00:00
|
|
|
|
2018-03-23 15:37:31 +00:00
|
|
|
[rand]: https://crates.io/crates/rand
|
|
|
|
|
|
|
|
|
|
|
|
## 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`, as well as
|
|
|
|
extensions to the `Error` type's functionality.
|
|
|
|
|
2018-03-25 09:27:25 +02:00
|
|
|
Due to [rust-lang/cargo#1596](https://github.com/rust-lang/cargo/issues/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 `rand_core`.
|
2018-03-08 11:54:13 +00:00
|
|
|
|
2018-04-13 09:58:03 +02:00
|
|
|
The `serde1` feature can be used to derive `Serialize` and `Deserialize` for RNG
|
|
|
|
implementations that use the `BlockRng` or `BlockRng64` wrappers.
|
|
|
|
|
2018-03-08 11:54:13 +00:00
|
|
|
|
|
|
|
# License
|
|
|
|
|
2018-03-25 09:27:25 +02:00
|
|
|
`rand_core` is distributed under the terms of both the MIT license and the
|
|
|
|
Apache License (Version 2.0).
|
2018-03-08 11:54:13 +00:00
|
|
|
|
2018-08-24 09:22:35 +01:00
|
|
|
See [LICENSE-APACHE](LICENSE-APACHE) and [LICENSE-MIT](LICENSE-MIT), and
|
|
|
|
[COPYRIGHT](COPYRIGHT) for details.
|