mirror of https://github.com/smol-rs/fastrand
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:
parent
4269d5dc45
commit
a0bb5c01e6
|
@ -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
|
||||
|
||||
|
|
|
@ -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)]
|
||||
|
|
Loading…
Reference in New Issue