docs: Mention fastrand-contrib in documentation

Also, port some bits over from src/lib.rs to README.md

Signed-off-by: John Nunley <dev@notgull.net>
This commit is contained in:
John Nunley 2023-09-17 09:36:32 -07:00 committed by GitHub
parent 4269d5dc45
commit a0bb5c01e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 1 deletions

View File

@ -83,11 +83,16 @@ let rng = fastrand::Rng::new();
let mut bytes: Vec<u8> = repeat_with(|| rng.u8(..)).take(10_000).collect();
```
This crate aims to expose a core set of useful randomness primitives. For more niche algorithms, consider using the [`fastrand-contrib`] crate alongside this one.
# Features
- `std` (enabled by default): Enables the `std` library. This is required for the global
generator and global entropy. Without this feature, [`Rng`] can only be instantiated using
the [`with_seed`](Rng::with_seed) method.
the [`with_seed`](https://docs.rs/fastrand/latest/fastrand/struct.Rng.html#method.with_seed) method.
- `js`: Assumes that WebAssembly targets are being run in a JavaScript environment.
[`fastrand-contrib`]: https://crates.io/crates/fastrand-contrib
## License

View File

@ -73,6 +73,9 @@
//! let mut bytes: Vec<u8> = repeat_with(|| rng.u8(..)).take(10_000).collect();
//! ```
//!
//! This crate aims to expose a core set of useful randomness primitives. For more niche algorithms,
//! consider using the [`fastrand-contrib`] crate alongside this one.
//!
//! # Features
//!
//! - `std` (enabled by default): Enables the `std` library. This is required for the global
@ -92,6 +95,7 @@
//! entropy sources and seed the global RNG. If the `js` feature is not enabled, the global RNG will
//! use a predefined seed.
//!
//! [`fastrand-contrib`]: https://crates.io/crates/fastrand-contrib
//! [`getrandom`]: https://crates.io/crates/getrandom
#![cfg_attr(not(feature = "std"), no_std)]