Skip to content

Commit

Permalink
docs: Mention fastrand-contrib in documentation
Browse files Browse the repository at this point in the history
Also, port some bits over from src/lib.rs to README.md

Signed-off-by: John Nunley <dev@notgull.net>
  • Loading branch information
notgull authored Sep 17, 2023
1 parent 4269d5d commit a0bb5c0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 4 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)]
Expand Down

0 comments on commit a0bb5c0

Please sign in to comment.