-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #61 from rust-random/work
Revise crates, portability, guide
- Loading branch information
Showing
17 changed files
with
320 additions
and
337 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Crate features | ||
|
||
For definitive documentation of crate features, check the crate release's `Cargo.toml`: | ||
|
||
- <https://docs.rs/crate/rand/latest/source/Cargo.toml.orig> | ||
- <https://docs.rs/crate/rand_core/latest/source/Cargo.toml.orig> | ||
- <https://docs.rs/crate/rand_distr/latest/source/Cargo.toml.orig> | ||
|
||
## Common features | ||
|
||
The following features are common to `rand_core`, `rand`, `rand_distr` and potentially some RNG crates: | ||
|
||
- `std`: opt into functionality dependent on the `std` lib. This is default-enabled except in `rand_core`; for `no_std` usage, use `default-features = false`. | ||
- `alloc`: enables functionality requiring an allocator (for usage with `no_std`). This is implied by `std`. | ||
- `serde1`: enables serialization via [`serde`], version 1.0. | ||
|
||
## Rand features | ||
|
||
Additional `rand` features: | ||
|
||
- `small_rng` enables the [`SmallRng`] generator (feature-gated since v0.7). | ||
- `simd_support`: Experimental support for generating various SIMD types (requires nightly `rustc`). | ||
- `log` enables a few log messages via [`log`]. | ||
|
||
Note regarding SIMD: the above flag concerns explicit generation of SIMD types | ||
only and not optimisation. SIMD operations may be used internally regardless of | ||
this flag; e.g. the ChaCha generator has explicit support for SIMD operations | ||
internally. | ||
|
||
## rand_distr features | ||
|
||
The floating point functions from `num_traits` and `libm` are used to support | ||
`no_std` environments and ensure reproducibility. If the floating point | ||
functions from `std` are preferred, which may provide better accuracy and | ||
performance but may produce different random values, the `std_math` feature | ||
can be enabled. (Note that any other crate depending on `num-traits`'s `std` feature (default-enabled) will have the same effect.) | ||
|
||
[`SmallRng`]: https://docs.rs/rand/latest/rand/rngs/struct.SmallRng.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Platform support | ||
|
||
Thanks to many community contributions, Rand crates support a wide variety of platforms. | ||
|
||
## no_std | ||
|
||
With `default-features = false`, both `rand` and `rand_distr` support `no_std` builds. See [Common features](crate-features.html#common-features). | ||
|
||
## getrandom | ||
|
||
The [`getrandom`] crate provides a low-level API around platform-specific | ||
random-number sources, and is an important building block of `rand` and | ||
`rand_core` as well as a number of cryptography libraries. | ||
It is not intended for usage outside of low-level libraries. | ||
|
||
### WebAssembly | ||
|
||
The `wasm32-unknown-unknown` target does not make any assumptions about which JavaScript interface is available, thus the `getrandom` crate requires configuration. See [WebAssembly support](https://docs.rs/getrandom/latest/getrandom/#webassembly-support). | ||
|
||
Note that the `wasm32-wasi` and `wasm32-unknown-emscripten` targets do not have this limitation. | ||
|
||
[`getrandom`]: https://docs.rs/getrandom/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.