diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-30 03:59:35 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-30 03:59:35 +0000 |
commit | d1b2d29528b7794b41e66fc2136e395a02f8529b (patch) | |
tree | a4a17504b260206dec3cf55b2dca82929a348ac2 /vendor/fastrand/README.md | |
parent | Releasing progress-linux version 1.72.1+dfsg1-1~progress7.99u1. (diff) | |
download | rustc-d1b2d29528b7794b41e66fc2136e395a02f8529b.tar.xz rustc-d1b2d29528b7794b41e66fc2136e395a02f8529b.zip |
Merging upstream version 1.73.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/fastrand/README.md')
-rw-r--r-- | vendor/fastrand/README.md | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/vendor/fastrand/README.md b/vendor/fastrand/README.md index 0da0612ea..70da00bc6 100644 --- a/vendor/fastrand/README.md +++ b/vendor/fastrand/README.md @@ -40,6 +40,13 @@ let i = fastrand::usize(..v.len()); let elem = v[i]; ``` +Sample values from an array with `O(n)` complexity (`n` is the length of array): + +```rust +fastrand::choose_multiple(vec![1, 4, 5].iter(), 2); +fastrand::choose_multiple(0..20, 12); +``` + Shuffle an array: ```rust @@ -76,6 +83,12 @@ let rng = fastrand::Rng::new(); let mut bytes: Vec<u8> = repeat_with(|| rng.u8(..)).take(10_000).collect(); ``` +# 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. + ## License Licensed under either of |