• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

src/H03-May-2022-1,436666

.cargo-checksum.jsonH A D03-May-202289 11

.cargo_vcs_info.jsonH A D01-Jan-197074 65

CHANGELOG.mdH A D28-Aug-20192.2 KiB5949

COPYRIGHTH A D22-Apr-2019569 139

Cargo.tomlH A D01-Jan-19701.3 KiB4439

Cargo.toml.orig-cargoH A D28-Aug-2019968 2925

LICENSE-APACHEH A D16-May-201910.6 KiB202169

LICENSE-MITH A D23-May-20191.1 KiB2723

README.mdH A D06-Aug-20193.6 KiB8359

README.md

1# rand_core
2
3[![Build Status](https://travis-ci.org/rust-random/rand.svg)](https://travis-ci.org/rust-random/rand)
4[![Build Status](https://ci.appveyor.com/api/projects/status/github/rust-random/rand?svg=true)](https://ci.appveyor.com/project/rust-random/rand)
5[![Latest version](https://img.shields.io/crates/v/rand_core.svg)](https://crates.io/crates/rand_core)
6[![Book](https://img.shields.io/badge/book-master-yellow.svg)](https://rust-random.github.io/book/)
7[![API](https://img.shields.io/badge/api-master-yellow.svg)](https://rust-random.github.io/rand/rand_core)
8[![API](https://docs.rs/rand_core/badge.svg)](https://docs.rs/rand_core)
9[![Minimum rustc version](https://img.shields.io/badge/rustc-1.32+-lightgray.svg)](https://github.com/rust-random/rand#rust-version-requirements)
10
11Core traits and error types of the [rand] library, plus tools for implementing
12RNGs.
13
14This crate is intended for use when implementing the core trait, `RngCore`; it
15defines the core traits to be implemented as well as several small functions to
16aid in their implementation and types required for error handling.
17
18The main [rand] crate re-exports most items defined in this crate, along with
19tools to convert the integer samples generated by `RngCore` to many different
20applications (including sampling from restricted ranges, conversion to floating
21point, list permutations and secure initialisation of RNGs). Most users should
22prefer to use the main [rand] crate.
23
24Links:
25
26-   [API documentation (master)](https://rust-random.github.io/rand/rand_core)
27-   [API documentation (docs.rs)](https://docs.rs/rand_core)
28-   [Changelog](https://github.com/rust-random/rand/blob/master/rand_core/CHANGELOG.md)
29
30[rand]: https://crates.io/crates/rand
31
32
33## Functionality
34
35The `rand_core` crate provides:
36
37-   base random number generator traits
38-   error-reporting types
39-   functionality to aid implementation of RNGs
40
41The traits and error types are also available via `rand`.
42
43## Versions
44
45The current version is:
46```
47rand_core = "0.5.0"
48```
49
50Rand libs have inter-dependencies and make use of the
51[semver trick](https://github.com/dtolnay/semver-trick/) in order to make traits
52compatible across crate versions. (This is especially important for `RngCore`
53and `SeedableRng`.) A few crate releases are thus compatibility shims,
54depending on the *next* lib version (e.g. `rand_core` versions `0.2.2` and
55`0.3.1`). This means, for example, that `rand_core_0_4_0::SeedableRng` and
56`rand_core_0_3_0::SeedableRng` are distinct, incompatible traits, which can
57cause build errors. Usually, running `cargo update` is enough to fix any issues.
58
59## Crate Features
60
61`rand_core` supports `no_std` and `alloc`-only configurations, as well as full
62`std` functionality. The differences between `no_std` and full `std` are small,
63comprising `RngCore` support for `Box<R>` types where `R: RngCore`,
64`std::io::Read` support for types supporting `RngCore`, and
65extensions to the `Error` type's functionality.
66
67The `std` feature is *not enabled by default*. This is primarily to avoid build
68problems where one crate implicitly requires `rand_core` with `std` support and
69another crate requires `rand` *without* `std` support. However, the `rand` crate
70continues to enable `std` support by default, both for itself and `rand_core`.
71
72The `serde1` feature can be used to derive `Serialize` and `Deserialize` for RNG
73implementations that use the `BlockRng` or `BlockRng64` wrappers.
74
75
76# License
77
78`rand_core` is distributed under the terms of both the MIT license and the
79Apache License (Version 2.0).
80
81See [LICENSE-APACHE](LICENSE-APACHE) and [LICENSE-MIT](LICENSE-MIT), and
82[COPYRIGHT](COPYRIGHT) for details.
83