From b5aa889f7fced8ba2cc1698ae9696d7bd0ca8ab5 Mon Sep 17 00:00:00 2001 From: garhve Date: Tue, 20 Dec 2022 11:07:35 +0800 Subject: remove compiled binary --- .../guessing_game/target/doc/rand/all.html | 2 - .../bernoulli/enum.BernoulliError.html | 11 -- .../distributions/bernoulli/struct.Bernoulli.html | 11 -- .../distribution/struct.DistIter.html | 11 -- .../distributions/distribution/struct.DistMap.html | 11 -- .../distribution/trait.DistString.html | 11 -- .../distribution/trait.Distribution.html | 11 -- .../rand/distributions/enum.BernoulliError.html | 13 -- .../doc/rand/distributions/enum.WeightedError.html | 20 -- .../rand/distributions/float/struct.Open01.html | 11 -- .../distributions/float/struct.OpenClosed01.html | 11 -- .../target/doc/rand/distributions/index.html | 64 ------ .../distributions/other/struct.Alphanumeric.html | 11 -- .../target/doc/rand/distributions/sidebar-items.js | 1 - .../doc/rand/distributions/slice/struct.Slice.html | 11 -- .../rand/distributions/struct.Alphanumeric.html | 38 ---- .../doc/rand/distributions/struct.Bernoulli.html | 36 ---- .../doc/rand/distributions/struct.DistIter.html | 43 ---- .../doc/rand/distributions/struct.DistMap.html | 12 -- .../doc/rand/distributions/struct.Open01.html | 24 --- .../rand/distributions/struct.OpenClosed01.html | 25 --- .../doc/rand/distributions/struct.Slice.html | 49 ----- .../doc/rand/distributions/struct.Standard.html | 216 --------------------- .../doc/rand/distributions/struct.Uniform.html | 48 ----- .../rand/distributions/struct.WeightedIndex.html | 63 ------ .../doc/rand/distributions/trait.DistString.html | 13 -- .../doc/rand/distributions/trait.Distribution.html | 65 ------- .../doc/rand/distributions/uniform/index.html | 83 -------- .../rand/distributions/uniform/sidebar-items.js | 1 - .../rand/distributions/uniform/struct.Uniform.html | 48 ----- .../distributions/uniform/struct.UniformChar.html | 16 -- .../uniform/struct.UniformDuration.html | 12 -- .../distributions/uniform/struct.UniformFloat.html | 25 --- .../distributions/uniform/struct.UniformInt.html | 70 ------- .../distributions/uniform/trait.SampleBorrow.html | 8 - .../distributions/uniform/trait.SampleRange.html | 10 - .../distributions/uniform/trait.SampleUniform.html | 9 - .../uniform/trait.UniformSampler.html | 50 ----- .../distributions/weighted/alias_method/index.html | 2 - .../weighted/alias_method/sidebar-items.js | 1 - .../alias_method/struct.WeightedIndex.html | 6 - .../weighted/alias_method/trait.Weight.html | 2 - .../distributions/weighted/enum.WeightedError.html | 20 -- .../doc/rand/distributions/weighted/index.html | 5 - .../rand/distributions/weighted/sidebar-items.js | 1 - .../weighted/struct.WeightedIndex.html | 63 ------ .../weighted_index/enum.WeightedError.html | 11 -- .../weighted_index/struct.WeightedIndex.html | 11 -- .../guessing_game/target/doc/rand/fn.random.html | 60 ------ .../target/doc/rand/fn.thread_rng.html | 8 - .../guessing_game/target/doc/rand/index.html | 33 ---- .../target/doc/rand/prelude/index.html | 8 - .../target/doc/rand/prelude/sidebar-items.js | 1 - .../target/doc/rand/rng/trait.Fill.html | 11 -- .../target/doc/rand/rng/trait.Rng.html | 11 -- .../target/doc/rand/rngs/adapter/index.html | 5 - .../rand/rngs/adapter/read/struct.ReadError.html | 11 -- .../doc/rand/rngs/adapter/read/struct.ReadRng.html | 11 -- .../adapter/reseeding/struct.ReseedingRng.html | 11 -- .../target/doc/rand/rngs/adapter/sidebar-items.js | 1 - .../doc/rand/rngs/adapter/struct.ReadError.html | 8 - .../doc/rand/rngs/adapter/struct.ReadRng.html | 17 -- .../doc/rand/rngs/adapter/struct.ReseedingRng.html | 61 ------ .../guessing_game/target/doc/rand/rngs/index.html | 73 ------- .../target/doc/rand/rngs/mock/index.html | 3 - .../target/doc/rand/rngs/mock/sidebar-items.js | 1 - .../target/doc/rand/rngs/mock/struct.StepRng.html | 21 -- .../target/doc/rand/rngs/sidebar-items.js | 1 - .../target/doc/rand/rngs/std/struct.StdRng.html | 11 -- .../target/doc/rand/rngs/struct.OsRng.html | 27 --- .../target/doc/rand/rngs/struct.StdRng.html | 19 -- .../target/doc/rand/rngs/struct.ThreadRng.html | 20 -- .../target/doc/rand/rngs/thread/fn.thread_rng.html | 11 -- .../doc/rand/rngs/thread/struct.ThreadRng.html | 11 -- .../guessing_game/target/doc/rand/seq/index.html | 18 -- .../target/doc/rand/seq/index/enum.IndexVec.html | 20 -- .../doc/rand/seq/index/enum.IndexVecIntoIter.html | 42 ---- .../doc/rand/seq/index/enum.IndexVecIter.html | 42 ---- .../target/doc/rand/seq/index/fn.sample.html | 19 -- .../doc/rand/seq/index/fn.sample_weighted.html | 13 -- .../target/doc/rand/seq/index/index.html | 7 - .../target/doc/rand/seq/index/sidebar-items.js | 1 - .../target/doc/rand/seq/sidebar-items.js | 1 - .../doc/rand/seq/struct.SliceChooseIter.html | 42 ---- .../target/doc/rand/seq/trait.IteratorRandom.html | 69 ------- .../target/doc/rand/seq/trait.SliceRandom.html | 127 ------------ .../guessing_game/target/doc/rand/sidebar-items.js | 1 - .../target/doc/rand/struct.Error.html | 37 ---- .../target/doc/rand/trait.CryptoRng.html | 18 -- .../guessing_game/target/doc/rand/trait.Fill.html | 10 - .../guessing_game/target/doc/rand/trait.Rng.html | 173 ----------------- .../target/doc/rand/trait.RngCore.html | 105 ---------- .../target/doc/rand/trait.SeedableRng.html | 110 ----------- 93 files changed, 2606 deletions(-) delete mode 100644 rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/all.html delete mode 100644 rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/bernoulli/enum.BernoulliError.html delete mode 100644 rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/bernoulli/struct.Bernoulli.html delete mode 100644 rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/distribution/struct.DistIter.html delete mode 100644 rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/distribution/struct.DistMap.html delete mode 100644 rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/distribution/trait.DistString.html delete mode 100644 rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/distribution/trait.Distribution.html delete mode 100644 rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/enum.BernoulliError.html delete mode 100644 rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/enum.WeightedError.html delete mode 100644 rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/float/struct.Open01.html delete mode 100644 rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/float/struct.OpenClosed01.html delete mode 100644 rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/index.html delete mode 100644 rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/other/struct.Alphanumeric.html delete mode 100644 rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/sidebar-items.js delete mode 100644 rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/slice/struct.Slice.html delete mode 100644 rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/struct.Alphanumeric.html delete mode 100644 rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/struct.Bernoulli.html delete mode 100644 rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/struct.DistIter.html delete mode 100644 rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/struct.DistMap.html delete mode 100644 rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/struct.Open01.html delete mode 100644 rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/struct.OpenClosed01.html delete mode 100644 rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/struct.Slice.html delete mode 100644 rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/struct.Standard.html delete mode 100644 rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/struct.Uniform.html delete mode 100644 rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/struct.WeightedIndex.html delete mode 100644 rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/trait.DistString.html delete mode 100644 rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/trait.Distribution.html delete mode 100644 rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/uniform/index.html delete mode 100644 rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/uniform/sidebar-items.js delete mode 100644 rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/uniform/struct.Uniform.html delete mode 100644 rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/uniform/struct.UniformChar.html delete mode 100644 rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/uniform/struct.UniformDuration.html delete mode 100644 rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/uniform/struct.UniformFloat.html delete mode 100644 rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/uniform/struct.UniformInt.html delete mode 100644 rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/uniform/trait.SampleBorrow.html delete mode 100644 rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/uniform/trait.SampleRange.html delete mode 100644 rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/uniform/trait.SampleUniform.html delete mode 100644 rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/uniform/trait.UniformSampler.html delete mode 100644 rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/weighted/alias_method/index.html delete mode 100644 rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/weighted/alias_method/sidebar-items.js delete mode 100644 rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/weighted/alias_method/struct.WeightedIndex.html delete mode 100644 rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/weighted/alias_method/trait.Weight.html delete mode 100644 rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/weighted/enum.WeightedError.html delete mode 100644 rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/weighted/index.html delete mode 100644 rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/weighted/sidebar-items.js delete mode 100644 rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/weighted/struct.WeightedIndex.html delete mode 100644 rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/weighted_index/enum.WeightedError.html delete mode 100644 rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/weighted_index/struct.WeightedIndex.html delete mode 100644 rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/fn.random.html delete mode 100644 rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/fn.thread_rng.html delete mode 100644 rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/index.html delete mode 100644 rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/prelude/index.html delete mode 100644 rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/prelude/sidebar-items.js delete mode 100644 rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/rng/trait.Fill.html delete mode 100644 rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/rng/trait.Rng.html delete mode 100644 rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/rngs/adapter/index.html delete mode 100644 rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/rngs/adapter/read/struct.ReadError.html delete mode 100644 rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/rngs/adapter/read/struct.ReadRng.html delete mode 100644 rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/rngs/adapter/reseeding/struct.ReseedingRng.html delete mode 100644 rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/rngs/adapter/sidebar-items.js delete mode 100644 rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/rngs/adapter/struct.ReadError.html delete mode 100644 rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/rngs/adapter/struct.ReadRng.html delete mode 100644 rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/rngs/adapter/struct.ReseedingRng.html delete mode 100644 rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/rngs/index.html delete mode 100644 rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/rngs/mock/index.html delete mode 100644 rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/rngs/mock/sidebar-items.js delete mode 100644 rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/rngs/mock/struct.StepRng.html delete mode 100644 rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/rngs/sidebar-items.js delete mode 100644 rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/rngs/std/struct.StdRng.html delete mode 100644 rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/rngs/struct.OsRng.html delete mode 100644 rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/rngs/struct.StdRng.html delete mode 100644 rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/rngs/struct.ThreadRng.html delete mode 100644 rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/rngs/thread/fn.thread_rng.html delete mode 100644 rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/rngs/thread/struct.ThreadRng.html delete mode 100644 rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/seq/index.html delete mode 100644 rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/seq/index/enum.IndexVec.html delete mode 100644 rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/seq/index/enum.IndexVecIntoIter.html delete mode 100644 rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/seq/index/enum.IndexVecIter.html delete mode 100644 rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/seq/index/fn.sample.html delete mode 100644 rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/seq/index/fn.sample_weighted.html delete mode 100644 rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/seq/index/index.html delete mode 100644 rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/seq/index/sidebar-items.js delete mode 100644 rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/seq/sidebar-items.js delete mode 100644 rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/seq/struct.SliceChooseIter.html delete mode 100644 rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/seq/trait.IteratorRandom.html delete mode 100644 rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/seq/trait.SliceRandom.html delete mode 100644 rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/sidebar-items.js delete mode 100644 rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/struct.Error.html delete mode 100644 rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/trait.CryptoRng.html delete mode 100644 rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/trait.Fill.html delete mode 100644 rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/trait.Rng.html delete mode 100644 rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/trait.RngCore.html delete mode 100644 rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/trait.SeedableRng.html (limited to 'rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand') diff --git a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/all.html b/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/all.html deleted file mode 100644 index c1b08fd..0000000 --- a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/all.html +++ /dev/null @@ -1,2 +0,0 @@ -List of all items in this crate
\ No newline at end of file diff --git a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/bernoulli/enum.BernoulliError.html b/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/bernoulli/enum.BernoulliError.html deleted file mode 100644 index 8f99e17..0000000 --- a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/bernoulli/enum.BernoulliError.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - - Redirection - - -

Redirecting to ../../../rand/distributions/enum.BernoulliError.html...

- - - \ No newline at end of file diff --git a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/bernoulli/struct.Bernoulli.html b/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/bernoulli/struct.Bernoulli.html deleted file mode 100644 index e46390a..0000000 --- a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/bernoulli/struct.Bernoulli.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - - Redirection - - -

Redirecting to ../../../rand/distributions/struct.Bernoulli.html...

- - - \ No newline at end of file diff --git a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/distribution/struct.DistIter.html b/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/distribution/struct.DistIter.html deleted file mode 100644 index fa75a92..0000000 --- a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/distribution/struct.DistIter.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - - Redirection - - -

Redirecting to ../../../rand/distributions/struct.DistIter.html...

- - - \ No newline at end of file diff --git a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/distribution/struct.DistMap.html b/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/distribution/struct.DistMap.html deleted file mode 100644 index 52d8cde..0000000 --- a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/distribution/struct.DistMap.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - - Redirection - - -

Redirecting to ../../../rand/distributions/struct.DistMap.html...

- - - \ No newline at end of file diff --git a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/distribution/trait.DistString.html b/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/distribution/trait.DistString.html deleted file mode 100644 index 72005a8..0000000 --- a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/distribution/trait.DistString.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - - Redirection - - -

Redirecting to ../../../rand/distributions/trait.DistString.html...

- - - \ No newline at end of file diff --git a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/distribution/trait.Distribution.html b/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/distribution/trait.Distribution.html deleted file mode 100644 index 83303bf..0000000 --- a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/distribution/trait.Distribution.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - - Redirection - - -

Redirecting to ../../../rand/distributions/trait.Distribution.html...

- - - \ No newline at end of file diff --git a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/enum.BernoulliError.html b/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/enum.BernoulliError.html deleted file mode 100644 index 428736e..0000000 --- a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/enum.BernoulliError.html +++ /dev/null @@ -1,13 +0,0 @@ -BernoulliError in rand::distributions - Rust
pub enum BernoulliError {
-    InvalidProbability,
-}
Expand description

Error type returned from Bernoulli::new.

-

Variants

InvalidProbability

p < 0 or p > 1.

-

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Formats the value using the given formatter. Read more
The lower-level source of this error, if any. Read more
👎Deprecated since 1.42.0: use the Display impl or to_string()
👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type based access to context intended for error reports. Read more
This method tests for self and other values to be equal, and is used -by ==. Read more
This method tests for !=. The default implementation is almost always -sufficient, and should not be overridden without very good reason. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

-

Calls U::from(self).

-

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-
🔬This is a nightly-only experimental API. (provide_any)
Data providers should implement this method to provide all values they are able to -provide by using demand. Read more
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
Converts the given value to a String. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/enum.WeightedError.html b/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/enum.WeightedError.html deleted file mode 100644 index c03171d..0000000 --- a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/enum.WeightedError.html +++ /dev/null @@ -1,20 +0,0 @@ -WeightedError in rand::distributions - Rust
pub enum WeightedError {
-    NoItem,
-    InvalidWeight,
-    AllWeightsZero,
-    TooMany,
-}
Expand description

Error type returned from WeightedIndex::new.

-

Variants

NoItem

The provided weight collection contains no items.

-

InvalidWeight

A weight is either less than zero, greater than the supported maximum, -NaN, or otherwise invalid.

-

AllWeightsZero

All items in the provided weight collection are zero.

-

TooMany

Too many weights are provided (length greater than u32::MAX)

-

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Formats the value using the given formatter. Read more
The lower-level source of this error, if any. Read more
👎Deprecated since 1.42.0: use the Display impl or to_string()
👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type based access to context intended for error reports. Read more
This method tests for self and other values to be equal, and is used -by ==. Read more
This method tests for !=. The default implementation is almost always -sufficient, and should not be overridden without very good reason. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

-

Calls U::from(self).

-

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-
🔬This is a nightly-only experimental API. (provide_any)
Data providers should implement this method to provide all values they are able to -provide by using demand. Read more
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
Converts the given value to a String. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/float/struct.Open01.html b/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/float/struct.Open01.html deleted file mode 100644 index d0747dc..0000000 --- a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/float/struct.Open01.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - - Redirection - - -

Redirecting to ../../../rand/distributions/struct.Open01.html...

- - - \ No newline at end of file diff --git a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/float/struct.OpenClosed01.html b/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/float/struct.OpenClosed01.html deleted file mode 100644 index 8a00205..0000000 --- a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/float/struct.OpenClosed01.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - - Redirection - - -

Redirecting to ../../../rand/distributions/struct.OpenClosed01.html...

- - - \ No newline at end of file diff --git a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/index.html b/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/index.html deleted file mode 100644 index 163d439..0000000 --- a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/index.html +++ /dev/null @@ -1,64 +0,0 @@ -rand::distributions - Rust
Expand description

Generating random samples from probability distributions

-

This module is the home of the Distribution trait and several of its -implementations. It is the workhorse behind some of the convenient -functionality of the Rng trait, e.g. Rng::gen and of course -Rng::sample.

-

Abstractly, a probability distribution describes the probability of -occurrence of each value in its sample space.

-

More concretely, an implementation of Distribution<T> for type X is an -algorithm for choosing values from the sample space (a subset of T) -according to the distribution X represents, using an external source of -randomness (an RNG supplied to the sample function).

-

A type X may implement Distribution<T> for multiple types T. -Any type implementing Distribution is stateless (i.e. immutable), -but it may have internal parameters set at construction time (for example, -Uniform allows specification of its sample space as a range within T).

-

The Standard distribution

-

The Standard distribution is important to mention. This is the -distribution used by Rng::gen and represents the “default” way to -produce a random value for many different types, including most primitive -types, tuples, arrays, and a few derived types. See the documentation of -Standard for more details.

-

Implementing Distribution<T> for Standard for user types T makes it -possible to generate type T with Rng::gen, and by extension also -with the random function.

-

Random characters

-

Alphanumeric is a simple distribution to sample random letters and -numbers of the char type; in contrast Standard may sample any valid -char.

-

Uniform numeric ranges

-

The Uniform distribution is more flexible than Standard, but also -more specialised: it supports fewer target types, but allows the sample -space to be specified as an arbitrary range within its target type T. -Both Standard and Uniform are in some sense uniform distributions.

-

Values may be sampled from this distribution using [Rng::sample(Range)] or -by creating a distribution object with Uniform::new, -Uniform::new_inclusive or From<Range>. When the range limits are not -known at compile time it is typically faster to reuse an existing -Uniform object than to call [Rng::sample(Range)].

-

User types T may also implement Distribution<T> for Uniform, -although this is less straightforward than for Standard (see the -documentation in the uniform module). Doing so enables generation of -values of type T with [Rng::sample(Range)].

-

Open and half-open ranges

-

There are surprisingly many ways to uniformly generate random floats. A -range between 0 and 1 is standard, but the exact bounds (open vs closed) -and accuracy differ. In addition to the Standard distribution Rand offers -Open01 and OpenClosed01. See “Floating point implementation” section of -Standard documentation for more details.

-

Non-uniform sampling

-

Sampling a simple true/false outcome with a given probability has a name: -the Bernoulli distribution (this is used by Rng::gen_bool).

-

For weighted sampling from a sequence of discrete values, use the -WeightedIndex distribution.

-

This crate no longer includes other non-uniform distributions; instead -it is recommended that you use either rand_distr or statrs.

-

Modules

A distribution uniformly sampling numbers within a given range.
weightedDeprecated
Weighted index sampling

Structs

Sample a u8, uniformly distributed over ASCII letters and numbers: -a-z, A-Z and 0-9.
The Bernoulli distribution.
An iterator that generates random values of T with distribution D, -using R as the source of randomness.
A distribution of values of type S derived from the distribution D -by mapping its output of type T through the closure F.
A distribution to sample floating point numbers uniformly in the open -interval (0, 1), i.e. not including either endpoint.
A distribution to sample floating point numbers uniformly in the half-open -interval (0, 1], i.e. including 1 but not 0.
A distribution to sample items uniformly from a slice.
A generic random value distribution, implemented for many primitive types. -Usually generates values with a numerically uniform distribution, and with a -range appropriate to the type.
Sample values uniformly between two bounds.
A distribution using weighted sampling of discrete items

Enums

Error type returned from Bernoulli::new.
Error type returned from WeightedIndex::new.

Traits

String sampler
Types (distributions) that can be used to create a random instance of T.
\ No newline at end of file diff --git a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/other/struct.Alphanumeric.html b/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/other/struct.Alphanumeric.html deleted file mode 100644 index 2560edb..0000000 --- a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/other/struct.Alphanumeric.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - - Redirection - - -

Redirecting to ../../../rand/distributions/struct.Alphanumeric.html...

- - - \ No newline at end of file diff --git a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/sidebar-items.js b/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/sidebar-items.js deleted file mode 100644 index 3d6b831..0000000 --- a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/sidebar-items.js +++ /dev/null @@ -1 +0,0 @@ -window.SIDEBAR_ITEMS = {"enum":[["BernoulliError","Error type returned from `Bernoulli::new`."],["WeightedError","Error type returned from `WeightedIndex::new`."]],"mod":[["uniform","A distribution uniformly sampling numbers within a given range."],["weighted","Weighted index sampling"]],"struct":[["Alphanumeric","Sample a `u8`, uniformly distributed over ASCII letters and numbers: a-z, A-Z and 0-9."],["Bernoulli","The Bernoulli distribution."],["DistIter","An iterator that generates random values of `T` with distribution `D`, using `R` as the source of randomness."],["DistMap","A distribution of values of type `S` derived from the distribution `D` by mapping its output of type `T` through the closure `F`."],["Open01","A distribution to sample floating point numbers uniformly in the open interval `(0, 1)`, i.e. not including either endpoint."],["OpenClosed01","A distribution to sample floating point numbers uniformly in the half-open interval `(0, 1]`, i.e. including 1 but not 0."],["Slice","A distribution to sample items uniformly from a slice."],["Standard","A generic random value distribution, implemented for many primitive types. Usually generates values with a numerically uniform distribution, and with a range appropriate to the type."],["Uniform","Sample values uniformly between two bounds."],["WeightedIndex","A distribution using weighted sampling of discrete items"]],"trait":[["DistString","`String` sampler"],["Distribution","Types (distributions) that can be used to create a random instance of `T`."]]}; \ No newline at end of file diff --git a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/slice/struct.Slice.html b/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/slice/struct.Slice.html deleted file mode 100644 index 729a322..0000000 --- a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/slice/struct.Slice.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - - Redirection - - -

Redirecting to ../../../rand/distributions/struct.Slice.html...

- - - \ No newline at end of file diff --git a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/struct.Alphanumeric.html b/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/struct.Alphanumeric.html deleted file mode 100644 index c7690c4..0000000 --- a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/struct.Alphanumeric.html +++ /dev/null @@ -1,38 +0,0 @@ -Alphanumeric in rand::distributions - Rust
pub struct Alphanumeric;
Expand description

Sample a u8, uniformly distributed over ASCII letters and numbers: -a-z, A-Z and 0-9.

-

Example

-
use rand::{Rng, thread_rng};
-use rand::distributions::Alphanumeric;
-
-let mut rng = thread_rng();
-let chars: String = (0..7).map(|_| rng.sample(Alphanumeric) as char).collect();
-println!("Random chars: {}", chars);
-

The DistString trait provides an easier method of generating -a random String, and offers more efficient allocation:

- -
use rand::distributions::{Alphanumeric, DistString};
-let string = Alphanumeric.sample_string(&mut rand::thread_rng(), 16);
-println!("Random string: {}", string);
-

Passwords

-

Users sometimes ask whether it is safe to use a string of random characters -as a password. In principle, all RNGs in Rand implementing CryptoRng are -suitable as a source of randomness for generating passwords (if they are -properly seeded), but it is more conservative to only use randomness -directly from the operating system via the getrandom crate, or the -corresponding bindings of a crypto library.

-

When generating passwords or keys, it is important to consider the threat -model and in some cases the memorability of the password. This is out of -scope of the Rand project, and therefore we defer to the following -references:

- -

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Append len random chars to string
Generate a String of len random chars
Generate a random value of T, using rng as the source of randomness.
Create an iterator that generates random values of T, using rng as -the source of randomness. Read more
Create a distribution of values of ‘S’ by mapping the output of Self -through the closure F Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

-

Calls U::from(self).

-

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/struct.Bernoulli.html b/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/struct.Bernoulli.html deleted file mode 100644 index 450b61d..0000000 --- a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/struct.Bernoulli.html +++ /dev/null @@ -1,36 +0,0 @@ -Bernoulli in rand::distributions - Rust
pub struct Bernoulli { /* private fields */ }
Expand description

The Bernoulli distribution.

-

This is a special case of the Binomial distribution where n = 1.

-

Example

-
use rand::distributions::{Bernoulli, Distribution};
-
-let d = Bernoulli::new(0.3).unwrap();
-let v = d.sample(&mut rand::thread_rng());
-println!("{} is from a Bernoulli distribution", v);
-

Precision

-

This Bernoulli distribution uses 64 bits from the RNG (a u64), -so only probabilities that are multiples of 2-64 can be -represented.

-

Implementations

Construct a new Bernoulli with the given probability of success p.

-
Precision
-

For p = 1.0, the resulting distribution will always generate true. -For p = 0.0, the resulting distribution will always generate false.

-

This method is accurate for any input p in the range [0, 1] which is -a multiple of 2-64. (Note that not all multiples of -2-64 in [0, 1] can be represented as a f64.)

-

Construct a new Bernoulli with the probability of success of -numerator-in-denominator. I.e. new_ratio(2, 3) will return -a Bernoulli with a 2-in-3 chance, or about 67%, of returning true.

-

return true. If numerator == 0 it will always return false. -For numerator > denominator and denominator == 0, this returns an -error. Otherwise, for numerator == denominator, samples are always -true; for numerator == 0 samples are always false.

-

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Generate a random value of T, using rng as the source of randomness.
Create an iterator that generates random values of T, using rng as -the source of randomness. Read more
Create a distribution of values of ‘S’ by mapping the output of Self -through the closure F Read more
This method tests for self and other values to be equal, and is used -by ==. Read more
This method tests for !=. The default implementation is almost always -sufficient, and should not be overridden without very good reason. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

-

Calls U::from(self).

-

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/struct.DistIter.html b/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/struct.DistIter.html deleted file mode 100644 index 134a4ce..0000000 --- a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/struct.DistIter.html +++ /dev/null @@ -1,43 +0,0 @@ -DistIter in rand::distributions - Rust
pub struct DistIter<D, R, T> { /* private fields */ }
Expand description

An iterator that generates random values of T with distribution D, -using R as the source of randomness.

-

This struct is created by the sample_iter method on Distribution. -See its documentation for more.

-

Trait Implementations

Formats the value using the given formatter. Read more
The type of the elements being iterated over.
Advances the iterator and returns the next value. Read more
Returns the bounds on the remaining length of the iterator. Read more
🔬This is a nightly-only experimental API. (iter_next_chunk)
Advances the iterator and returns an array containing the next N values. Read more
Consumes the iterator, counting the number of iterations and returning it. Read more
Consumes the iterator, returning the last element. Read more
🔬This is a nightly-only experimental API. (iter_advance_by)
Advances the iterator by n elements. Read more
Returns the nth element of the iterator. Read more
Creates an iterator starting at the same point, but stepping by -the given amount at each iteration. Read more
Takes two iterators and creates a new iterator over both in sequence. Read more
‘Zips up’ two iterators into a single iterator of pairs. Read more
🔬This is a nightly-only experimental API. (iter_intersperse)
Creates a new iterator which places an item generated by separator -between adjacent items of the original iterator. Read more
Takes a closure and creates an iterator which calls that closure on each -element. Read more
Calls a closure on each element of an iterator. Read more
Creates an iterator which uses a closure to determine if an element -should be yielded. Read more
Creates an iterator that both filters and maps. Read more
Creates an iterator which gives the current iteration count as well as -the next value. Read more
Creates an iterator which can use the peek and peek_mut methods -to look at the next element of the iterator without consuming it. See -their documentation for more information. Read more
Creates an iterator that skips elements based on a predicate. Read more
Creates an iterator that yields elements based on a predicate. Read more
Creates an iterator that both yields elements based on a predicate and maps. Read more
Creates an iterator that skips the first n elements. Read more
Creates an iterator that yields the first n elements, or fewer -if the underlying iterator ends sooner. Read more
An iterator adapter similar to fold that holds internal state and -produces a new iterator. Read more
Creates an iterator that works like map, but flattens nested structure. Read more
Creates an iterator which ends after the first None. Read more
Does something with each element of an iterator, passing the value on. Read more
Borrows an iterator, rather than consuming it. Read more
Transforms an iterator into a collection. Read more
🔬This is a nightly-only experimental API. (iter_collect_into)
Collects all the items from an iterator into a collection. Read more
Consumes an iterator, creating two collections from it. Read more
🔬This is a nightly-only experimental API. (iter_is_partitioned)
Checks if the elements of this iterator are partitioned according to the given predicate, -such that all those that return true precede all those that return false. Read more
An iterator method that applies a function as long as it returns -successfully, producing a single, final value. Read more
An iterator method that applies a fallible function to each item in the -iterator, stopping at the first error and returning that error. Read more
Folds every element into an accumulator by applying an operation, -returning the final result. Read more
Reduces the elements to a single one, by repeatedly applying a reducing -operation. Read more
🔬This is a nightly-only experimental API. (iterator_try_reduce)
Reduces the elements to a single one by repeatedly applying a reducing operation. If the -closure returns a failure, the failure is propagated back to the caller immediately. Read more
Tests if every element of the iterator matches a predicate. Read more
Tests if any element of the iterator matches a predicate. Read more
Searches for an element of an iterator that satisfies a predicate. Read more
Applies function to the elements of iterator and returns -the first non-none result. Read more
🔬This is a nightly-only experimental API. (try_find)
Applies function to the elements of iterator and returns -the first true result or the first error. Read more
Searches for an element in an iterator, returning its index. Read more
Returns the element that gives the maximum value from the -specified function. Read more
Returns the element that gives the maximum value with respect to the -specified comparison function. Read more
Returns the element that gives the minimum value from the -specified function. Read more
Returns the element that gives the minimum value with respect to the -specified comparison function. Read more
Converts an iterator of pairs into a pair of containers. Read more
Creates an iterator which copies all of its elements. Read more
Creates an iterator which clones all of its elements. Read more
🔬This is a nightly-only experimental API. (iter_array_chunks)
Returns an iterator over N elements of the iterator at a time. Read more
Sums the elements of an iterator. Read more
Iterates over the entire iterator, multiplying all the elements Read more
🔬This is a nightly-only experimental API. (iter_order_by)
Lexicographically compares the elements of this Iterator with those -of another with respect to the specified comparison function. Read more
Lexicographically compares the elements of this Iterator with those -of another. Read more
🔬This is a nightly-only experimental API. (iter_order_by)
Lexicographically compares the elements of this Iterator with those -of another with respect to the specified comparison function. Read more
Determines if the elements of this Iterator are equal to those of -another. Read more
🔬This is a nightly-only experimental API. (iter_order_by)
Determines if the elements of this Iterator are equal to those of -another with respect to the specified equality function. Read more
Determines if the elements of this Iterator are unequal to those of -another. Read more
Determines if the elements of this Iterator are lexicographically -less than those of another. Read more
Determines if the elements of this Iterator are lexicographically -less or equal to those of another. Read more
Determines if the elements of this Iterator are lexicographically -greater than those of another. Read more
Determines if the elements of this Iterator are lexicographically -greater than or equal to those of another. Read more
🔬This is a nightly-only experimental API. (is_sorted)
Checks if the elements of this iterator are sorted using the given comparator function. Read more
🔬This is a nightly-only experimental API. (is_sorted)
Checks if the elements of this iterator are sorted using the given key extraction -function. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

-

Calls U::from(self).

-

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-
The type of the elements being iterated over.
Which kind of iterator are we turning this into?
Creates an iterator from a value. Read more
Choose one element at random from the iterator. Read more
Choose one element at random from the iterator. Read more
Collects values at random from the iterator into a supplied buffer -until that buffer is filled. Read more
Collects amount values at random from the iterator into a vector. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/struct.DistMap.html b/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/struct.DistMap.html deleted file mode 100644 index 308adaa..0000000 --- a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/struct.DistMap.html +++ /dev/null @@ -1,12 +0,0 @@ -DistMap in rand::distributions - Rust
pub struct DistMap<D, F, T, S> { /* private fields */ }
Expand description

A distribution of values of type S derived from the distribution D -by mapping its output of type T through the closure F.

-

This struct is created by the Distribution::map method. -See its documentation for more.

-

Trait Implementations

Formats the value using the given formatter. Read more
Generate a random value of T, using rng as the source of randomness.
Create an iterator that generates random values of T, using rng as -the source of randomness. Read more
Create a distribution of values of ‘S’ by mapping the output of Self -through the closure F Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

-

Calls U::from(self).

-

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/struct.Open01.html b/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/struct.Open01.html deleted file mode 100644 index 27dfd08..0000000 --- a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/struct.Open01.html +++ /dev/null @@ -1,24 +0,0 @@ -Open01 in rand::distributions - Rust
pub struct Open01;
Expand description

A distribution to sample floating point numbers uniformly in the open -interval (0, 1), i.e. not including either endpoint.

-

All values that can be generated are of the form n * ε + ε/2. For f32 -the 23 most significant random bits of an u32 are used, for f64 52 from -an u64. The conversion uses a transmute-based method.

-

See also: Standard which samples from [0, 1), OpenClosed01 -which samples from (0, 1] and Uniform which samples from arbitrary -ranges.

-

Example

-
use rand::{thread_rng, Rng};
-use rand::distributions::Open01;
-
-let val: f32 = thread_rng().sample(Open01);
-println!("f32 from (0, 1): {}", val);
-

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Generate a random value of T, using rng as the source of randomness.
Create an iterator that generates random values of T, using rng as -the source of randomness. Read more
Create a distribution of values of ‘S’ by mapping the output of Self -through the closure F Read more
Generate a random value of T, using rng as the source of randomness.
Create an iterator that generates random values of T, using rng as -the source of randomness. Read more
Create a distribution of values of ‘S’ by mapping the output of Self -through the closure F Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

-

Calls U::from(self).

-

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/struct.OpenClosed01.html b/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/struct.OpenClosed01.html deleted file mode 100644 index 0cdffb0..0000000 --- a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/struct.OpenClosed01.html +++ /dev/null @@ -1,25 +0,0 @@ -OpenClosed01 in rand::distributions - Rust
pub struct OpenClosed01;
Expand description

A distribution to sample floating point numbers uniformly in the half-open -interval (0, 1], i.e. including 1 but not 0.

-

All values that can be generated are of the form n * ε/2. For f32 -the 24 most significant random bits of a u32 are used and for f64 the -53 most significant bits of a u64 are used. The conversion uses the -multiplicative method.

-

See also: Standard which samples from [0, 1), Open01 -which samples from (0, 1) and Uniform which samples from arbitrary -ranges.

-

Example

-
use rand::{thread_rng, Rng};
-use rand::distributions::OpenClosed01;
-
-let val: f32 = thread_rng().sample(OpenClosed01);
-println!("f32 from (0, 1): {}", val);
-

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Generate a random value of T, using rng as the source of randomness.
Create an iterator that generates random values of T, using rng as -the source of randomness. Read more
Create a distribution of values of ‘S’ by mapping the output of Self -through the closure F Read more
Generate a random value of T, using rng as the source of randomness.
Create an iterator that generates random values of T, using rng as -the source of randomness. Read more
Create a distribution of values of ‘S’ by mapping the output of Self -through the closure F Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

-

Calls U::from(self).

-

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/struct.Slice.html b/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/struct.Slice.html deleted file mode 100644 index 0a17e40..0000000 --- a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/struct.Slice.html +++ /dev/null @@ -1,49 +0,0 @@ -Slice in rand::distributions - Rust
pub struct Slice<'a, T> { /* private fields */ }
Expand description

A distribution to sample items uniformly from a slice.

-

Slice::new constructs a distribution referencing a slice and uniformly -samples references from the items in the slice. It may do extra work up -front to make sampling of multiple values faster; if only one sample from -the slice is required, SliceRandom::choose can be more efficient.

-

Steps are taken to avoid bias which might be present in naive -implementations; for example slice[rng.gen() % slice.len()] samples from -the slice, but may be more likely to select numbers in the low range than -other values.

-

This distribution samples with replacement; each sample is independent. -Sampling without replacement requires state to be retained, and therefore -cannot be handled by a distribution; you should instead consider methods -on SliceRandom, such as SliceRandom::choose_multiple.

-

Example

-
use rand::Rng;
-use rand::distributions::Slice;
-
-let vowels = ['a', 'e', 'i', 'o', 'u'];
-let vowels_dist = Slice::new(&vowels).unwrap();
-let rng = rand::thread_rng();
-
-// build a string of 10 vowels
-let vowel_string: String = rng
-    .sample_iter(&vowels_dist)
-    .take(10)
-    .collect();
-
-println!("{}", vowel_string);
-assert_eq!(vowel_string.len(), 10);
-assert!(vowel_string.chars().all(|c| vowels.contains(&c)));
-

For a single sample, SliceRandom::choose -may be preferred:

- -
use rand::seq::SliceRandom;
-
-let vowels = ['a', 'e', 'i', 'o', 'u'];
-let mut rng = rand::thread_rng();
-
-println!("{}", vowels.choose(&mut rng).unwrap())
-

Implementations

Create a new Slice instance which samples uniformly from the slice. -Returns Err if the slice is empty.

-

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Generate a random value of T, using rng as the source of randomness.
Create an iterator that generates random values of T, using rng as -the source of randomness. Read more
Create a distribution of values of ‘S’ by mapping the output of Self -through the closure F Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

-

Calls U::from(self).

-

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/struct.Standard.html b/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/struct.Standard.html deleted file mode 100644 index 2a0b9da..0000000 --- a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/struct.Standard.html +++ /dev/null @@ -1,216 +0,0 @@ -Standard in rand::distributions - Rust
pub struct Standard;
Expand description

A generic random value distribution, implemented for many primitive types. -Usually generates values with a numerically uniform distribution, and with a -range appropriate to the type.

-

Provided implementations

-

Assuming the provided Rng is well-behaved, these implementations -generate values with the following ranges and distributions:

-
    -
  • Integers (i32, u32, isize, usize, etc.): Uniformly distributed -over all values of the type.
  • -
  • char: Uniformly distributed over all Unicode scalar values, i.e. all -code points in the range 0...0x10_FFFF, except for the range -0xD800...0xDFFF (the surrogate code points). This includes -unassigned/reserved code points.
  • -
  • bool: Generates false or true, each with probability 0.5.
  • -
  • Floating point types (f32 and f64): Uniformly distributed in the -half-open range [0, 1). See notes below.
  • -
  • Wrapping integers (Wrapping<T>), besides the type identical to their -normal integer variants.
  • -
-

The Standard distribution also supports generation of the following -compound types where all component types are supported:

-
    -
  • Tuples (up to 12 elements): each element is generated sequentially.
  • -
  • Arrays (up to 32 elements): each element is generated sequentially; -see also Rng::fill which supports arbitrary array length for integer -and float types and tends to be faster for u32 and smaller types. -When using rustc ≥ 1.51, enable the min_const_gen feature to support -arrays larger than 32 elements. -Note that Rng::fill and Standard’s array support are not equivalent: -the former is optimised for integer types (using fewer RNG calls for -element types smaller than the RNG word size), while the latter supports -any element type supported by Standard.
  • -
  • Option<T> first generates a bool, and if true generates and returns -Some(value) where value: T, otherwise returning None.
  • -
-

Custom implementations

-

The Standard distribution may be implemented for user types as follows:

- -
use rand::Rng;
-use rand::distributions::{Distribution, Standard};
-
-struct MyF32 {
-    x: f32,
-}
-
-impl Distribution<MyF32> for Standard {
-    fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> MyF32 {
-        MyF32 { x: rng.gen() }
-    }
-}
-

Example usage

-
use rand::prelude::*;
-use rand::distributions::Standard;
-
-let val: f32 = StdRng::from_entropy().sample(Standard);
-println!("f32 from [0, 1): {}", val);
-

Floating point implementation

-

The floating point implementations for Standard generate a random value in -the half-open interval [0, 1), i.e. including 0 but not 1.

-

All values that can be generated are of the form n * ε/2. For f32 -the 24 most significant random bits of a u32 are used and for f64 the -53 most significant bits of a u64 are used. The conversion uses the -multiplicative method: (rng.gen::<$uty>() >> N) as $ty * (ε/2).

-

See also: Open01 which samples from (0, 1), OpenClosed01 which -samples from (0, 1] and Rng::gen_range(0..1) which also samples from -[0, 1). Note that Open01 uses transmute-based methods which yield 1 bit -less precision but may perform faster on some architectures (on modern Intel -CPUs all methods have approximately equal performance).

-

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more

Note: the String is potentially left with excess capacity; optionally the -user may call string.shrink_to_fit() afterwards.

-
Append len random chars to string
Generate a String of len random chars
Generate a random value of T, using rng as the source of randomness.
Create an iterator that generates random values of T, using rng as -the source of randomness. Read more
Create a distribution of values of ‘S’ by mapping the output of Self -through the closure F Read more
Generate a random value of T, using rng as the source of randomness.
Create an iterator that generates random values of T, using rng as -the source of randomness. Read more
Create a distribution of values of ‘S’ by mapping the output of Self -through the closure F Read more
Generate a random value of T, using rng as the source of randomness.
Create an iterator that generates random values of T, using rng as -the source of randomness. Read more
Create a distribution of values of ‘S’ by mapping the output of Self -through the closure F Read more
Generate a random value of T, using rng as the source of randomness.
Create an iterator that generates random values of T, using rng as -the source of randomness. Read more
Create a distribution of values of ‘S’ by mapping the output of Self -through the closure F Read more
Generate a random value of T, using rng as the source of randomness.
Create an iterator that generates random values of T, using rng as -the source of randomness. Read more
Create a distribution of values of ‘S’ by mapping the output of Self -through the closure F Read more
Generate a random value of T, using rng as the source of randomness.
Create an iterator that generates random values of T, using rng as -the source of randomness. Read more
Create a distribution of values of ‘S’ by mapping the output of Self -through the closure F Read more
Generate a random value of T, using rng as the source of randomness.
Create an iterator that generates random values of T, using rng as -the source of randomness. Read more
Create a distribution of values of ‘S’ by mapping the output of Self -through the closure F Read more
Generate a random value of T, using rng as the source of randomness.
Create an iterator that generates random values of T, using rng as -the source of randomness. Read more
Create a distribution of values of ‘S’ by mapping the output of Self -through the closure F Read more
Generate a random value of T, using rng as the source of randomness.
Create an iterator that generates random values of T, using rng as -the source of randomness. Read more
Create a distribution of values of ‘S’ by mapping the output of Self -through the closure F Read more
Generate a random value of T, using rng as the source of randomness.
Create an iterator that generates random values of T, using rng as -the source of randomness. Read more
Create a distribution of values of ‘S’ by mapping the output of Self -through the closure F Read more
Generate a random value of T, using rng as the source of randomness.
Create an iterator that generates random values of T, using rng as -the source of randomness. Read more
Create a distribution of values of ‘S’ by mapping the output of Self -through the closure F Read more
Generate a random value of T, using rng as the source of randomness.
Create an iterator that generates random values of T, using rng as -the source of randomness. Read more
Create a distribution of values of ‘S’ by mapping the output of Self -through the closure F Read more
Generate a random value of T, using rng as the source of randomness.
Create an iterator that generates random values of T, using rng as -the source of randomness. Read more
Create a distribution of values of ‘S’ by mapping the output of Self -through the closure F Read more
Generate a random value of T, using rng as the source of randomness.
Create an iterator that generates random values of T, using rng as -the source of randomness. Read more
Create a distribution of values of ‘S’ by mapping the output of Self -through the closure F Read more
Generate a random value of T, using rng as the source of randomness.
Create an iterator that generates random values of T, using rng as -the source of randomness. Read more
Create a distribution of values of ‘S’ by mapping the output of Self -through the closure F Read more
Generate a random value of T, using rng as the source of randomness.
Create an iterator that generates random values of T, using rng as -the source of randomness. Read more
Create a distribution of values of ‘S’ by mapping the output of Self -through the closure F Read more
Generate a random value of T, using rng as the source of randomness.
Create an iterator that generates random values of T, using rng as -the source of randomness. Read more
Create a distribution of values of ‘S’ by mapping the output of Self -through the closure F Read more
Generate a random value of T, using rng as the source of randomness.
Create an iterator that generates random values of T, using rng as -the source of randomness. Read more
Create a distribution of values of ‘S’ by mapping the output of Self -through the closure F Read more
Generate a random value of T, using rng as the source of randomness.
Create an iterator that generates random values of T, using rng as -the source of randomness. Read more
Create a distribution of values of ‘S’ by mapping the output of Self -through the closure F Read more
Generate a random value of T, using rng as the source of randomness.
Create an iterator that generates random values of T, using rng as -the source of randomness. Read more
Create a distribution of values of ‘S’ by mapping the output of Self -through the closure F Read more
Generate a random value of T, using rng as the source of randomness.
Create an iterator that generates random values of T, using rng as -the source of randomness. Read more
Create a distribution of values of ‘S’ by mapping the output of Self -through the closure F Read more
Generate a random value of T, using rng as the source of randomness.
Create an iterator that generates random values of T, using rng as -the source of randomness. Read more
Create a distribution of values of ‘S’ by mapping the output of Self -through the closure F Read more
Generate a random value of T, using rng as the source of randomness.
Create an iterator that generates random values of T, using rng as -the source of randomness. Read more
Create a distribution of values of ‘S’ by mapping the output of Self -through the closure F Read more
Generate a random value of T, using rng as the source of randomness.
Create an iterator that generates random values of T, using rng as -the source of randomness. Read more
Create a distribution of values of ‘S’ by mapping the output of Self -through the closure F Read more
Generate a random value of T, using rng as the source of randomness.
Create an iterator that generates random values of T, using rng as -the source of randomness. Read more
Create a distribution of values of ‘S’ by mapping the output of Self -through the closure F Read more
Generate a random value of T, using rng as the source of randomness.
Create an iterator that generates random values of T, using rng as -the source of randomness. Read more
Create a distribution of values of ‘S’ by mapping the output of Self -through the closure F Read more
Generate a random value of T, using rng as the source of randomness.
Create an iterator that generates random values of T, using rng as -the source of randomness. Read more
Create a distribution of values of ‘S’ by mapping the output of Self -through the closure F Read more
Generate a random value of T, using rng as the source of randomness.
Create an iterator that generates random values of T, using rng as -the source of randomness. Read more
Create a distribution of values of ‘S’ by mapping the output of Self -through the closure F Read more
Generate a random value of T, using rng as the source of randomness.
Create an iterator that generates random values of T, using rng as -the source of randomness. Read more
Create a distribution of values of ‘S’ by mapping the output of Self -through the closure F Read more
Generate a random value of T, using rng as the source of randomness.
Create an iterator that generates random values of T, using rng as -the source of randomness. Read more
Create a distribution of values of ‘S’ by mapping the output of Self -through the closure F Read more
Generate a random value of T, using rng as the source of randomness.
Create an iterator that generates random values of T, using rng as -the source of randomness. Read more
Create a distribution of values of ‘S’ by mapping the output of Self -through the closure F Read more
Generate a random value of T, using rng as the source of randomness.
Create an iterator that generates random values of T, using rng as -the source of randomness. Read more
Create a distribution of values of ‘S’ by mapping the output of Self -through the closure F Read more
Generate a random value of T, using rng as the source of randomness.
Create an iterator that generates random values of T, using rng as -the source of randomness. Read more
Create a distribution of values of ‘S’ by mapping the output of Self -through the closure F Read more
Generate a random value of T, using rng as the source of randomness.
Create an iterator that generates random values of T, using rng as -the source of randomness. Read more
Create a distribution of values of ‘S’ by mapping the output of Self -through the closure F Read more
Generate a random value of T, using rng as the source of randomness.
Create an iterator that generates random values of T, using rng as -the source of randomness. Read more
Create a distribution of values of ‘S’ by mapping the output of Self -through the closure F Read more
Generate a random value of T, using rng as the source of randomness.
Create an iterator that generates random values of T, using rng as -the source of randomness. Read more
Create a distribution of values of ‘S’ by mapping the output of Self -through the closure F Read more
Generate a random value of T, using rng as the source of randomness.
Create an iterator that generates random values of T, using rng as -the source of randomness. Read more
Create a distribution of values of ‘S’ by mapping the output of Self -through the closure F Read more
Generate a random value of T, using rng as the source of randomness.
Create an iterator that generates random values of T, using rng as -the source of randomness. Read more
Create a distribution of values of ‘S’ by mapping the output of Self -through the closure F Read more
Generate a random value of T, using rng as the source of randomness.
Create an iterator that generates random values of T, using rng as -the source of randomness. Read more
Create a distribution of values of ‘S’ by mapping the output of Self -through the closure F Read more
Generate a random value of T, using rng as the source of randomness.
Create an iterator that generates random values of T, using rng as -the source of randomness. Read more
Create a distribution of values of ‘S’ by mapping the output of Self -through the closure F Read more
Generate a random value of T, using rng as the source of randomness.
Create an iterator that generates random values of T, using rng as -the source of randomness. Read more
Create a distribution of values of ‘S’ by mapping the output of Self -through the closure F Read more
Generate a random value of T, using rng as the source of randomness.
Create an iterator that generates random values of T, using rng as -the source of randomness. Read more
Create a distribution of values of ‘S’ by mapping the output of Self -through the closure F Read more
Generate a random value of T, using rng as the source of randomness.
Create an iterator that generates random values of T, using rng as -the source of randomness. Read more
Create a distribution of values of ‘S’ by mapping the output of Self -through the closure F Read more
Generate a random value of T, using rng as the source of randomness.
Create an iterator that generates random values of T, using rng as -the source of randomness. Read more
Create a distribution of values of ‘S’ by mapping the output of Self -through the closure F Read more
Generate a random value of T, using rng as the source of randomness.
Create an iterator that generates random values of T, using rng as -the source of randomness. Read more
Create a distribution of values of ‘S’ by mapping the output of Self -through the closure F Read more
Generate a random value of T, using rng as the source of randomness.
Create an iterator that generates random values of T, using rng as -the source of randomness. Read more
Create a distribution of values of ‘S’ by mapping the output of Self -through the closure F Read more
Generate a random value of T, using rng as the source of randomness.
Create an iterator that generates random values of T, using rng as -the source of randomness. Read more
Create a distribution of values of ‘S’ by mapping the output of Self -through the closure F Read more
Generate a random value of T, using rng as the source of randomness.
Create an iterator that generates random values of T, using rng as -the source of randomness. Read more
Create a distribution of values of ‘S’ by mapping the output of Self -through the closure F Read more
Generate a random value of T, using rng as the source of randomness.
Create an iterator that generates random values of T, using rng as -the source of randomness. Read more
Create a distribution of values of ‘S’ by mapping the output of Self -through the closure F Read more
Generate a random value of T, using rng as the source of randomness.
Create an iterator that generates random values of T, using rng as -the source of randomness. Read more
Create a distribution of values of ‘S’ by mapping the output of Self -through the closure F Read more
Generate a random value of T, using rng as the source of randomness.
Create an iterator that generates random values of T, using rng as -the source of randomness. Read more
Create a distribution of values of ‘S’ by mapping the output of Self -through the closure F Read more
Generate a random value of T, using rng as the source of randomness.
Create an iterator that generates random values of T, using rng as -the source of randomness. Read more
Create a distribution of values of ‘S’ by mapping the output of Self -through the closure F Read more
Generate a random value of T, using rng as the source of randomness.
Create an iterator that generates random values of T, using rng as -the source of randomness. Read more
Create a distribution of values of ‘S’ by mapping the output of Self -through the closure F Read more
Generate a random value of T, using rng as the source of randomness.
Create an iterator that generates random values of T, using rng as -the source of randomness. Read more
Create a distribution of values of ‘S’ by mapping the output of Self -through the closure F Read more
Generate a random value of T, using rng as the source of randomness.
Create an iterator that generates random values of T, using rng as -the source of randomness. Read more
Create a distribution of values of ‘S’ by mapping the output of Self -through the closure F Read more
Generate a random value of T, using rng as the source of randomness.
Create an iterator that generates random values of T, using rng as -the source of randomness. Read more
Create a distribution of values of ‘S’ by mapping the output of Self -through the closure F Read more
Generate a random value of T, using rng as the source of randomness.
Create an iterator that generates random values of T, using rng as -the source of randomness. Read more
Create a distribution of values of ‘S’ by mapping the output of Self -through the closure F Read more
Generate a random value of T, using rng as the source of randomness.
Create an iterator that generates random values of T, using rng as -the source of randomness. Read more
Create a distribution of values of ‘S’ by mapping the output of Self -through the closure F Read more
Generate a random value of T, using rng as the source of randomness.
Create an iterator that generates random values of T, using rng as -the source of randomness. Read more
Create a distribution of values of ‘S’ by mapping the output of Self -through the closure F Read more
Generate a random value of T, using rng as the source of randomness.
Create an iterator that generates random values of T, using rng as -the source of randomness. Read more
Create a distribution of values of ‘S’ by mapping the output of Self -through the closure F Read more
Generate a random value of T, using rng as the source of randomness.
Create an iterator that generates random values of T, using rng as -the source of randomness. Read more
Create a distribution of values of ‘S’ by mapping the output of Self -through the closure F Read more
Generate a random value of T, using rng as the source of randomness.
Create an iterator that generates random values of T, using rng as -the source of randomness. Read more
Create a distribution of values of ‘S’ by mapping the output of Self -through the closure F Read more
Generate a random value of T, using rng as the source of randomness.
Create an iterator that generates random values of T, using rng as -the source of randomness. Read more
Create a distribution of values of ‘S’ by mapping the output of Self -through the closure F Read more
Generate a random value of T, using rng as the source of randomness.
Create an iterator that generates random values of T, using rng as -the source of randomness. Read more
Create a distribution of values of ‘S’ by mapping the output of Self -through the closure F Read more
Generate a random value of T, using rng as the source of randomness.
Create an iterator that generates random values of T, using rng as -the source of randomness. Read more
Create a distribution of values of ‘S’ by mapping the output of Self -through the closure F Read more
Generate a random value of T, using rng as the source of randomness.
Create an iterator that generates random values of T, using rng as -the source of randomness. Read more
Create a distribution of values of ‘S’ by mapping the output of Self -through the closure F Read more
Generate a random value of T, using rng as the source of randomness.
Create an iterator that generates random values of T, using rng as -the source of randomness. Read more
Create a distribution of values of ‘S’ by mapping the output of Self -through the closure F Read more
Generate a random value of T, using rng as the source of randomness.
Create an iterator that generates random values of T, using rng as -the source of randomness. Read more
Create a distribution of values of ‘S’ by mapping the output of Self -through the closure F Read more
Generate a random value of T, using rng as the source of randomness.
Create an iterator that generates random values of T, using rng as -the source of randomness. Read more
Create a distribution of values of ‘S’ by mapping the output of Self -through the closure F Read more
Generate a random value of T, using rng as the source of randomness.
Create an iterator that generates random values of T, using rng as -the source of randomness. Read more
Create a distribution of values of ‘S’ by mapping the output of Self -through the closure F Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

-

Calls U::from(self).

-

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/struct.Uniform.html b/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/struct.Uniform.html deleted file mode 100644 index 30c5b1c..0000000 --- a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/struct.Uniform.html +++ /dev/null @@ -1,48 +0,0 @@ -Uniform in rand::distributions - Rust
pub struct Uniform<X: SampleUniform>(_);
Expand description

Sample values uniformly between two bounds.

-

Uniform::new and Uniform::new_inclusive construct a uniform -distribution sampling from the given range; these functions may do extra -work up front to make sampling of multiple values faster. If only one sample -from the range is required, Rng::gen_range can be more efficient.

-

When sampling from a constant range, many calculations can happen at -compile-time and all methods should be fast; for floating-point ranges and -the full range of integer types this should have comparable performance to -the Standard distribution.

-

Steps are taken to avoid bias which might be present in naive -implementations; for example rng.gen::<u8>() % 170 samples from the range -[0, 169] but is twice as likely to select numbers less than 85 than other -values. Further, the implementations here give more weight to the high-bits -generated by the RNG than the low bits, since with some RNGs the low-bits -are of lower quality than the high bits.

-

Implementations must sample in [low, high) range for -Uniform::new(low, high), i.e., excluding high. In particular, care must -be taken to ensure that rounding never results values < low or >= high.

-

Example

-
use rand::distributions::{Distribution, Uniform};
-
-let between = Uniform::from(10..10000);
-let mut rng = rand::thread_rng();
-let mut sum = 0;
-for _ in 0..1000 {
-    sum += between.sample(&mut rng);
-}
-println!("{}", sum);
-

For a single sample, Rng::gen_range may be preferred:

- -
use rand::Rng;
-
-let mut rng = rand::thread_rng();
-println!("{}", rng.gen_range(0..10));
-

Implementations

Create a new Uniform instance which samples uniformly from the half -open range [low, high) (excluding high). Panics if low >= high.

-

Create a new Uniform instance which samples uniformly from the closed -range [low, high] (inclusive). Panics if low > high.

-

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Generate a random value of T, using rng as the source of randomness.
Create an iterator that generates random values of T, using rng as -the source of randomness. Read more
Create a distribution of values of ‘S’ by mapping the output of Self -through the closure F Read more
Converts to this type from the input type.
Converts to this type from the input type.
This method tests for self and other values to be equal, and is used -by ==. Read more
This method tests for !=. The default implementation is almost always -sufficient, and should not be overridden without very good reason. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

-

Calls U::from(self).

-

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/struct.WeightedIndex.html b/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/struct.WeightedIndex.html deleted file mode 100644 index 8e9e8e1..0000000 --- a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/struct.WeightedIndex.html +++ /dev/null @@ -1,63 +0,0 @@ -WeightedIndex in rand::distributions - Rust
pub struct WeightedIndex<X: SampleUniform + PartialOrd> { /* private fields */ }
Expand description

A distribution using weighted sampling of discrete items

-

Sampling a WeightedIndex distribution returns the index of a randomly -selected element from the iterator used when the WeightedIndex was -created. The chance of a given element being picked is proportional to the -value of the element. The weights can use any type X for which an -implementation of Uniform<X> exists.

-

Performance

-

Time complexity of sampling from WeightedIndex is O(log N) where -N is the number of weights. As an alternative, -rand_distr::weighted_alias -supports O(1) sampling, but with much higher initialisation cost.

-

A WeightedIndex<X> contains a Vec<X> and a Uniform<X> and so its -size is the sum of the size of those objects, possibly plus some alignment.

-

Creating a WeightedIndex<X> will allocate enough space to hold N - 1 -weights of type X, where N is the number of weights. However, since -Vec doesn’t guarantee a particular growth strategy, additional memory -might be allocated but not used. Since the WeightedIndex object also -contains, this might cause additional allocations, though for primitive -types, Uniform<X> doesn’t allocate any memory.

-

Sampling from WeightedIndex will result in a single call to -Uniform<X>::sample (method of the Distribution trait), which typically -will request a single value from the underlying RngCore, though the -exact number depends on the implementation of Uniform<X>::sample.

-

Example

-
use rand::prelude::*;
-use rand::distributions::WeightedIndex;
-
-let choices = ['a', 'b', 'c'];
-let weights = [2,   1,   1];
-let dist = WeightedIndex::new(&weights).unwrap();
-let mut rng = thread_rng();
-for _ in 0..100 {
-    // 50% chance to print 'a', 25% chance to print 'b', 25% chance to print 'c'
-    println!("{}", choices[dist.sample(&mut rng)]);
-}
-
-let items = [('a', 0), ('b', 3), ('c', 7)];
-let dist2 = WeightedIndex::new(items.iter().map(|item| item.1)).unwrap();
-for _ in 0..100 {
-    // 0% chance to print 'a', 30% chance to print 'b', 70% chance to print 'c'
-    println!("{}", items[dist2.sample(&mut rng)].0);
-}
-

Implementations

Creates a new a WeightedIndex Distribution using the values -in weights. The weights can use any type X for which an -implementation of Uniform<X> exists.

-

Returns an error if the iterator is empty, if any weight is < 0, or -if its total value is 0.

-

Update a subset of weights, without changing the number of weights.

-

new_weights must be sorted by the index.

-

Using this method instead of new might be more efficient if only a small number of -weights is modified. No allocations are performed, unless the weight type X uses -allocation internally.

-

In case of error, self is not modified.

-

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Generate a random value of T, using rng as the source of randomness.
Create an iterator that generates random values of T, using rng as -the source of randomness. Read more
Create a distribution of values of ‘S’ by mapping the output of Self -through the closure F Read more
This method tests for self and other values to be equal, and is used -by ==. Read more
This method tests for !=. The default implementation is almost always -sufficient, and should not be overridden without very good reason. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

-

Calls U::from(self).

-

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/trait.DistString.html b/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/trait.DistString.html deleted file mode 100644 index 8b31106..0000000 --- a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/trait.DistString.html +++ /dev/null @@ -1,13 +0,0 @@ -DistString in rand::distributions - Rust
pub trait DistString {
-    fn append_string<R: Rng + ?Sized>(
        &self,
        rng: &mut R,
        string: &mut String,
        len: usize
    ); - - fn sample_string<R: Rng + ?Sized>(&self, rng: &mut R, len: usize) -> String { ... } -}
Expand description

String sampler

-

Sampling a String of random characters is not quite the same as collecting -a sequence of chars. This trait contains some helpers.

-

Required Methods

Append len random chars to string

-

Provided Methods

Generate a String of len random chars

-

Implementors

Note: the String is potentially left with excess capacity; optionally the -user may call string.shrink_to_fit() afterwards.

-
\ No newline at end of file diff --git a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/trait.Distribution.html b/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/trait.Distribution.html deleted file mode 100644 index 32c5f9d..0000000 --- a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/trait.Distribution.html +++ /dev/null @@ -1,65 +0,0 @@ -Distribution in rand::distributions - Rust
pub trait Distribution<T> {
-    fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> T;
-
-    fn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T>Notable traits for DistIter<D, R, T>impl<D, R, T> Iterator for DistIter<D, R, T>where
    D: Distribution<T>,
    R: Rng,
type Item = T;

    where
        R: Rng,
        Self: Sized
, - { ... } - fn map<F, S>(self, func: F) -> DistMap<Self, F, T, S>
    where
        F: Fn(T) -> S,
        Self: Sized
, - { ... } -}
Expand description

Types (distributions) that can be used to create a random instance of T.

-

It is possible to sample from a distribution through both the -Distribution and Rng traits, via distr.sample(&mut rng) and -rng.sample(distr). They also both offer the sample_iter method, which -produces an iterator that samples from the distribution.

-

All implementations are expected to be immutable; this has the significant -advantage of not needing to consider thread safety, and for most -distributions efficient state-less sampling algorithms are available.

-

Implementations are typically expected to be portable with reproducible -results when used with a PRNG with fixed seed; see the -portability chapter -of The Rust Rand Book. In some cases this does not apply, e.g. the usize -type requires different sampling on 32-bit and 64-bit machines.

-

Required Methods

Generate a random value of T, using rng as the source of randomness.

-

Provided Methods

Create an iterator that generates random values of T, using rng as -the source of randomness.

-

Note that this function takes self by value. This works since -Distribution<T> is impl’d for &D where D: Distribution<T>, -however borrowing is not automatic hence distr.sample_iter(...) may -need to be replaced with (&distr).sample_iter(...) to borrow or -(&*distr).sample_iter(...) to reborrow an existing reference.

-
Example
-
use rand::thread_rng;
-use rand::distributions::{Distribution, Alphanumeric, Uniform, Standard};
-
-let mut rng = thread_rng();
-
-// Vec of 16 x f32:
-let v: Vec<f32> = Standard.sample_iter(&mut rng).take(16).collect();
-
-// String:
-let s: String = Alphanumeric
-    .sample_iter(&mut rng)
-    .take(7)
-    .map(char::from)
-    .collect();
-
-// Dice-rolling:
-let die_range = Uniform::new_inclusive(1, 6);
-let mut roll_die = die_range.sample_iter(&mut rng);
-while roll_die.next().unwrap() != 6 {
-    println!("Not a 6; rolling again!");
-}
-

Create a distribution of values of ‘S’ by mapping the output of Self -through the closure F

-
Example
-
use rand::thread_rng;
-use rand::distributions::{Distribution, Uniform};
-
-let mut rng = thread_rng();
-
-let die = Uniform::new_inclusive(1, 6);
-let even_number = die.map(|num| num % 2 == 0);
-while !even_number.sample(&mut rng) {
-    println!("Still odd; rolling again!");
-}
-

Implementations on Foreign Types

Implementors

\ No newline at end of file diff --git a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/uniform/index.html b/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/uniform/index.html deleted file mode 100644 index f89bdf1..0000000 --- a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/uniform/index.html +++ /dev/null @@ -1,83 +0,0 @@ -rand::distributions::uniform - Rust
Expand description

A distribution uniformly sampling numbers within a given range.

-

Uniform is the standard distribution to sample uniformly from a range; -e.g. Uniform::new_inclusive(1, 6) can sample integers from 1 to 6, like a -standard die. Rng::gen_range supports any type supported by -Uniform.

-

This distribution is provided with support for several primitive types -(all integer and floating-point types) as well as std::time::Duration, -and supports extension to user-defined types via a type-specific back-end -implementation.

-

The types UniformInt, UniformFloat and UniformDuration are the -back-ends supporting sampling from primitive integer and floating-point -ranges as well as from std::time::Duration; these types do not normally -need to be used directly (unless implementing a derived back-end).

-

Example usage

-
use rand::{Rng, thread_rng};
-use rand::distributions::Uniform;
-
-let mut rng = thread_rng();
-let side = Uniform::new(-10.0, 10.0);
-
-// sample between 1 and 10 points
-for _ in 0..rng.gen_range(1..=10) {
-    // sample a point from the square with sides -10 - 10 in two dimensions
-    let (x, y) = (rng.sample(side), rng.sample(side));
-    println!("Point: {}, {}", x, y);
-}
-

Extending Uniform to support a custom type

-

To extend Uniform to support your own types, write a back-end which -implements the UniformSampler trait, then implement the SampleUniform -helper trait to “register” your back-end. See the MyF32 example below.

-

At a minimum, the back-end needs to store any parameters needed for sampling -(e.g. the target range) and implement new, new_inclusive and sample. -Those methods should include an assert to check the range is valid (i.e. -low < high). The example below merely wraps another back-end.

-

The new, new_inclusive and sample_single functions use arguments of -type SampleBorrow in order to support passing in values by reference or -by value. In the implementation of these functions, you can choose to -simply use the reference returned by SampleBorrow::borrow, or you can choose -to copy or clone the value, whatever is appropriate for your type.

- -
use rand::prelude::*;
-use rand::distributions::uniform::{Uniform, SampleUniform,
-        UniformSampler, UniformFloat, SampleBorrow};
-
-struct MyF32(f32);
-
-#[derive(Clone, Copy, Debug)]
-struct UniformMyF32(UniformFloat<f32>);
-
-impl UniformSampler for UniformMyF32 {
-    type X = MyF32;
-    fn new<B1, B2>(low: B1, high: B2) -> Self
-        where B1: SampleBorrow<Self::X> + Sized,
-              B2: SampleBorrow<Self::X> + Sized
-    {
-        UniformMyF32(UniformFloat::<f32>::new(low.borrow().0, high.borrow().0))
-    }
-    fn new_inclusive<B1, B2>(low: B1, high: B2) -> Self
-        where B1: SampleBorrow<Self::X> + Sized,
-              B2: SampleBorrow<Self::X> + Sized
-    {
-        UniformMyF32(UniformFloat::<f32>::new_inclusive(
-            low.borrow().0,
-            high.borrow().0,
-        ))
-    }
-    fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> Self::X {
-        MyF32(self.0.sample(rng))
-    }
-}
-
-impl SampleUniform for MyF32 {
-    type Sampler = UniformMyF32;
-}
-
-let (low, high) = (MyF32(17.0f32), MyF32(22.0f32));
-let uniform = Uniform::new(low, high);
-let x = uniform.sample(&mut thread_rng());
-

Structs

Sample values uniformly between two bounds.
The back-end implementing UniformSampler for char.
The back-end implementing UniformSampler for Duration.
The back-end implementing UniformSampler for floating-point types.
The back-end implementing UniformSampler for integer types.

Traits

Helper trait similar to Borrow but implemented -only for SampleUniform and references to SampleUniform in -order to resolve ambiguity issues.
Range that supports generating a single sample efficiently.
Helper trait for creating objects using the correct implementation of -UniformSampler for the sampling type.
Helper trait handling actual uniform sampling.
\ No newline at end of file diff --git a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/uniform/sidebar-items.js b/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/uniform/sidebar-items.js deleted file mode 100644 index fe9e7eb..0000000 --- a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/uniform/sidebar-items.js +++ /dev/null @@ -1 +0,0 @@ -window.SIDEBAR_ITEMS = {"struct":[["Uniform","Sample values uniformly between two bounds."],["UniformChar","The back-end implementing [`UniformSampler`] for `char`."],["UniformDuration","The back-end implementing [`UniformSampler`] for `Duration`."],["UniformFloat","The back-end implementing [`UniformSampler`] for floating-point types."],["UniformInt","The back-end implementing [`UniformSampler`] for integer types."]],"trait":[["SampleBorrow","Helper trait similar to `Borrow` but implemented only for SampleUniform and references to SampleUniform in order to resolve ambiguity issues."],["SampleRange","Range that supports generating a single sample efficiently."],["SampleUniform","Helper trait for creating objects using the correct implementation of [`UniformSampler`] for the sampling type."],["UniformSampler","Helper trait handling actual uniform sampling."]]}; \ No newline at end of file diff --git a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/uniform/struct.Uniform.html b/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/uniform/struct.Uniform.html deleted file mode 100644 index aeb84e8..0000000 --- a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/uniform/struct.Uniform.html +++ /dev/null @@ -1,48 +0,0 @@ -Uniform in rand::distributions::uniform - Rust
pub struct Uniform<X: SampleUniform>(_);
Expand description

Sample values uniformly between two bounds.

-

Uniform::new and Uniform::new_inclusive construct a uniform -distribution sampling from the given range; these functions may do extra -work up front to make sampling of multiple values faster. If only one sample -from the range is required, Rng::gen_range can be more efficient.

-

When sampling from a constant range, many calculations can happen at -compile-time and all methods should be fast; for floating-point ranges and -the full range of integer types this should have comparable performance to -the Standard distribution.

-

Steps are taken to avoid bias which might be present in naive -implementations; for example rng.gen::<u8>() % 170 samples from the range -[0, 169] but is twice as likely to select numbers less than 85 than other -values. Further, the implementations here give more weight to the high-bits -generated by the RNG than the low bits, since with some RNGs the low-bits -are of lower quality than the high bits.

-

Implementations must sample in [low, high) range for -Uniform::new(low, high), i.e., excluding high. In particular, care must -be taken to ensure that rounding never results values < low or >= high.

-

Example

-
use rand::distributions::{Distribution, Uniform};
-
-let between = Uniform::from(10..10000);
-let mut rng = rand::thread_rng();
-let mut sum = 0;
-for _ in 0..1000 {
-    sum += between.sample(&mut rng);
-}
-println!("{}", sum);
-

For a single sample, Rng::gen_range may be preferred:

- -
use rand::Rng;
-
-let mut rng = rand::thread_rng();
-println!("{}", rng.gen_range(0..10));
-

Implementations

Create a new Uniform instance which samples uniformly from the half -open range [low, high) (excluding high). Panics if low >= high.

-

Create a new Uniform instance which samples uniformly from the closed -range [low, high] (inclusive). Panics if low > high.

-

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Generate a random value of T, using rng as the source of randomness.
Create an iterator that generates random values of T, using rng as -the source of randomness. Read more
Create a distribution of values of ‘S’ by mapping the output of Self -through the closure F Read more
Converts to this type from the input type.
Converts to this type from the input type.
This method tests for self and other values to be equal, and is used -by ==. Read more
This method tests for !=. The default implementation is almost always -sufficient, and should not be overridden without very good reason. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

-

Calls U::from(self).

-

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/uniform/struct.UniformChar.html b/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/uniform/struct.UniformChar.html deleted file mode 100644 index df29473..0000000 --- a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/uniform/struct.UniformChar.html +++ /dev/null @@ -1,16 +0,0 @@ -UniformChar in rand::distributions::uniform - Rust
pub struct UniformChar { /* private fields */ }
Expand description

The back-end implementing UniformSampler for char.

-

Unless you are implementing UniformSampler for your own type, this type -should not be used directly, use Uniform instead.

-

This differs from integer range sampling since the range 0xD800..=0xDFFF -are used for surrogate pairs in UCS and UTF-16, and consequently are not -valid Unicode code points. We must therefore avoid sampling values in this -range.

-

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
The type sampled by this implementation.
Construct self, with inclusive lower bound and exclusive upper bound -[low, high). Read more
Construct self, with inclusive bounds [low, high]. Read more
Sample a value.
Sample a single value uniformly from a range with inclusive lower bound -and exclusive upper bound [low, high). Read more
Sample a single value uniformly from a range with inclusive lower bound -and inclusive upper bound [low, high]. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

-

Calls U::from(self).

-

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/uniform/struct.UniformDuration.html b/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/uniform/struct.UniformDuration.html deleted file mode 100644 index 0c844a2..0000000 --- a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/uniform/struct.UniformDuration.html +++ /dev/null @@ -1,12 +0,0 @@ -UniformDuration in rand::distributions::uniform - Rust
pub struct UniformDuration { /* private fields */ }
Expand description

The back-end implementing UniformSampler for Duration.

-

Unless you are implementing UniformSampler for your own types, this type -should not be used directly, use Uniform instead.

-

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
The type sampled by this implementation.
Construct self, with inclusive lower bound and exclusive upper bound -[low, high). Read more
Construct self, with inclusive bounds [low, high]. Read more
Sample a value.
Sample a single value uniformly from a range with inclusive lower bound -and exclusive upper bound [low, high). Read more
Sample a single value uniformly from a range with inclusive lower bound -and inclusive upper bound [low, high]. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

-

Calls U::from(self).

-

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/uniform/struct.UniformFloat.html b/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/uniform/struct.UniformFloat.html deleted file mode 100644 index 8cffcd3..0000000 --- a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/uniform/struct.UniformFloat.html +++ /dev/null @@ -1,25 +0,0 @@ -UniformFloat in rand::distributions::uniform - Rust
pub struct UniformFloat<X> { /* private fields */ }
Expand description

The back-end implementing UniformSampler for floating-point types.

-

Unless you are implementing UniformSampler for your own type, this type -should not be used directly, use Uniform instead.

-

Implementation notes

-

Instead of generating a float in the [0, 1) range using Standard, the -UniformFloat implementation converts the output of an PRNG itself. This -way one or two steps can be optimized out.

-

The floats are first converted to a value in the [1, 2) interval using a -transmute-based method, and then mapped to the expected range with a -multiply and addition. Values produced this way have what equals 23 bits of -random digits for an f32, and 52 for an f64.

-

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
This method tests for self and other values to be equal, and is used -by ==. Read more
This method tests for !=. The default implementation is almost always -sufficient, and should not be overridden without very good reason. Read more
The type sampled by this implementation.
Construct self, with inclusive lower bound and exclusive upper bound -[low, high). Read more
Construct self, with inclusive bounds [low, high]. Read more
Sample a value.
Sample a single value uniformly from a range with inclusive lower bound -and exclusive upper bound [low, high). Read more
Sample a single value uniformly from a range with inclusive lower bound -and inclusive upper bound [low, high]. Read more
The type sampled by this implementation.
Construct self, with inclusive lower bound and exclusive upper bound -[low, high). Read more
Construct self, with inclusive bounds [low, high]. Read more
Sample a value.
Sample a single value uniformly from a range with inclusive lower bound -and exclusive upper bound [low, high). Read more
Sample a single value uniformly from a range with inclusive lower bound -and inclusive upper bound [low, high]. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

-

Calls U::from(self).

-

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/uniform/struct.UniformInt.html b/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/uniform/struct.UniformInt.html deleted file mode 100644 index bebe178..0000000 --- a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/uniform/struct.UniformInt.html +++ /dev/null @@ -1,70 +0,0 @@ -UniformInt in rand::distributions::uniform - Rust
pub struct UniformInt<X> { /* private fields */ }
Expand description

The back-end implementing UniformSampler for integer types.

-

Unless you are implementing UniformSampler for your own type, this type -should not be used directly, use Uniform instead.

-

Implementation notes

-

For simplicity, we use the same generic struct UniformInt<X> for all -integer types X. This gives us only one field type, X; to store unsigned -values of this size, we take use the fact that these conversions are no-ops.

-

For a closed range, the number of possible numbers we should generate is -range = (high - low + 1). To avoid bias, we must ensure that the size of -our sample space, zone, is a multiple of range; other values must be -rejected (by replacing with a new random sample).

-

As a special case, we use range = 0 to represent the full range of the -result type (i.e. for new_inclusive($ty::MIN, $ty::MAX)).

-

The optimum zone is the largest product of range which fits in our -(unsigned) target type. We calculate this by calculating how many numbers we -must reject: reject = (MAX + 1) % range = (MAX - range + 1) % range. Any (large) -product of range will suffice, thus in sample_single we multiply by a -power of 2 via bit-shifting (faster but may cause more rejections).

-

The smallest integer PRNGs generate is u32. For 8- and 16-bit outputs we -use u32 for our zone and samples (because it’s not slower and because -it reduces the chance of having to reject a sample). In this case we cannot -store zone in the target type since it is too large, however we know -ints_to_reject < range <= $unsigned::MAX.

-

An alternative to using a modulus is widening multiply: After a widening -multiply by range, the result is in the high word. Then comparing the low -word against zone makes sure our distribution is uniform.

-

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
This method tests for self and other values to be equal, and is used -by ==. Read more
This method tests for !=. The default implementation is almost always -sufficient, and should not be overridden without very good reason. Read more
The type sampled by this implementation.
Construct self, with inclusive lower bound and exclusive upper bound -[low, high). Read more
Construct self, with inclusive bounds [low, high]. Read more
Sample a value.
Sample a single value uniformly from a range with inclusive lower bound -and exclusive upper bound [low, high). Read more
Sample a single value uniformly from a range with inclusive lower bound -and inclusive upper bound [low, high]. Read more
The type sampled by this implementation.
Construct self, with inclusive lower bound and exclusive upper bound -[low, high). Read more
Construct self, with inclusive bounds [low, high]. Read more
Sample a value.
Sample a single value uniformly from a range with inclusive lower bound -and exclusive upper bound [low, high). Read more
Sample a single value uniformly from a range with inclusive lower bound -and inclusive upper bound [low, high]. Read more
The type sampled by this implementation.
Construct self, with inclusive lower bound and exclusive upper bound -[low, high). Read more
Construct self, with inclusive bounds [low, high]. Read more
Sample a value.
Sample a single value uniformly from a range with inclusive lower bound -and exclusive upper bound [low, high). Read more
Sample a single value uniformly from a range with inclusive lower bound -and inclusive upper bound [low, high]. Read more
The type sampled by this implementation.
Construct self, with inclusive lower bound and exclusive upper bound -[low, high). Read more
Construct self, with inclusive bounds [low, high]. Read more
Sample a value.
Sample a single value uniformly from a range with inclusive lower bound -and exclusive upper bound [low, high). Read more
Sample a single value uniformly from a range with inclusive lower bound -and inclusive upper bound [low, high]. Read more
The type sampled by this implementation.
Construct self, with inclusive lower bound and exclusive upper bound -[low, high). Read more
Construct self, with inclusive bounds [low, high]. Read more
Sample a value.
Sample a single value uniformly from a range with inclusive lower bound -and exclusive upper bound [low, high). Read more
Sample a single value uniformly from a range with inclusive lower bound -and inclusive upper bound [low, high]. Read more
The type sampled by this implementation.
Construct self, with inclusive lower bound and exclusive upper bound -[low, high). Read more
Construct self, with inclusive bounds [low, high]. Read more
Sample a value.
Sample a single value uniformly from a range with inclusive lower bound -and exclusive upper bound [low, high). Read more
Sample a single value uniformly from a range with inclusive lower bound -and inclusive upper bound [low, high]. Read more
The type sampled by this implementation.
Construct self, with inclusive lower bound and exclusive upper bound -[low, high). Read more
Construct self, with inclusive bounds [low, high]. Read more
Sample a value.
Sample a single value uniformly from a range with inclusive lower bound -and exclusive upper bound [low, high). Read more
Sample a single value uniformly from a range with inclusive lower bound -and inclusive upper bound [low, high]. Read more
The type sampled by this implementation.
Construct self, with inclusive lower bound and exclusive upper bound -[low, high). Read more
Construct self, with inclusive bounds [low, high]. Read more
Sample a value.
Sample a single value uniformly from a range with inclusive lower bound -and exclusive upper bound [low, high). Read more
Sample a single value uniformly from a range with inclusive lower bound -and inclusive upper bound [low, high]. Read more
The type sampled by this implementation.
Construct self, with inclusive lower bound and exclusive upper bound -[low, high). Read more
Construct self, with inclusive bounds [low, high]. Read more
Sample a value.
Sample a single value uniformly from a range with inclusive lower bound -and exclusive upper bound [low, high). Read more
Sample a single value uniformly from a range with inclusive lower bound -and inclusive upper bound [low, high]. Read more
The type sampled by this implementation.
Construct self, with inclusive lower bound and exclusive upper bound -[low, high). Read more
Construct self, with inclusive bounds [low, high]. Read more
Sample a value.
Sample a single value uniformly from a range with inclusive lower bound -and exclusive upper bound [low, high). Read more
Sample a single value uniformly from a range with inclusive lower bound -and inclusive upper bound [low, high]. Read more
The type sampled by this implementation.
Construct self, with inclusive lower bound and exclusive upper bound -[low, high). Read more
Construct self, with inclusive bounds [low, high]. Read more
Sample a value.
Sample a single value uniformly from a range with inclusive lower bound -and exclusive upper bound [low, high). Read more
Sample a single value uniformly from a range with inclusive lower bound -and inclusive upper bound [low, high]. Read more
The type sampled by this implementation.
Construct self, with inclusive lower bound and exclusive upper bound -[low, high). Read more
Construct self, with inclusive bounds [low, high]. Read more
Sample a value.
Sample a single value uniformly from a range with inclusive lower bound -and exclusive upper bound [low, high). Read more
Sample a single value uniformly from a range with inclusive lower bound -and inclusive upper bound [low, high]. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

-

Calls U::from(self).

-

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/uniform/trait.SampleBorrow.html b/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/uniform/trait.SampleBorrow.html deleted file mode 100644 index ca043fd..0000000 --- a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/uniform/trait.SampleBorrow.html +++ /dev/null @@ -1,8 +0,0 @@ -SampleBorrow in rand::distributions::uniform - Rust
pub trait SampleBorrow<Borrowed> {
-    fn borrow(&self) -> &Borrowed;
-}
Expand description

Helper trait similar to Borrow but implemented -only for SampleUniform and references to SampleUniform in -order to resolve ambiguity issues.

-

Required Methods

Immutably borrows from an owned value. See Borrow::borrow

-

Implementations on Foreign Types

Implementors

\ No newline at end of file diff --git a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/uniform/trait.SampleRange.html b/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/uniform/trait.SampleRange.html deleted file mode 100644 index ea9195f..0000000 --- a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/uniform/trait.SampleRange.html +++ /dev/null @@ -1,10 +0,0 @@ -SampleRange in rand::distributions::uniform - Rust
pub trait SampleRange<T> {
-    fn sample_single<R: RngCore + ?Sized>(self, rng: &mut R) -> T;
-    fn is_empty(&self) -> bool;
-}
Expand description

Range that supports generating a single sample efficiently.

-

Any type implementing this trait can be used to specify the sampled range -for Rng::gen_range.

-

Required Methods

Generate a sample from the given range.

-

Check whether the range is empty.

-

Implementations on Foreign Types

Implementors

\ No newline at end of file diff --git a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/uniform/trait.SampleUniform.html b/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/uniform/trait.SampleUniform.html deleted file mode 100644 index a7eeb8e..0000000 --- a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/uniform/trait.SampleUniform.html +++ /dev/null @@ -1,9 +0,0 @@ -SampleUniform in rand::distributions::uniform - Rust
pub trait SampleUniform: Sized {
-    type Sampler: UniformSampler<X = Self>;
-}
Expand description

Helper trait for creating objects using the correct implementation of -UniformSampler for the sampling type.

-

See the module documentation on how to implement Uniform range -sampling for a custom type.

-

Required Associated Types

The UniformSampler implementation supporting type X.

-

Implementations on Foreign Types

Implementors

\ No newline at end of file diff --git a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/uniform/trait.UniformSampler.html b/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/uniform/trait.UniformSampler.html deleted file mode 100644 index fc307c4..0000000 --- a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/uniform/trait.UniformSampler.html +++ /dev/null @@ -1,50 +0,0 @@ -UniformSampler in rand::distributions::uniform - Rust
pub trait UniformSampler: Sized {
-    type X;
-
-    fn new<B1, B2>(low: B1, high: B2) -> Self
    where
        B1: SampleBorrow<Self::X> + Sized,
        B2: SampleBorrow<Self::X> + Sized
; - fn new_inclusive<B1, B2>(low: B1, high: B2) -> Self
    where
        B1: SampleBorrow<Self::X> + Sized,
        B2: SampleBorrow<Self::X> + Sized
; - fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> Self::X; - - fn sample_single<R: Rng + ?Sized, B1, B2>(
        low: B1,
        high: B2,
        rng: &mut R
    ) -> Self::X
    where
        B1: SampleBorrow<Self::X> + Sized,
        B2: SampleBorrow<Self::X> + Sized
, - { ... } - fn sample_single_inclusive<R: Rng + ?Sized, B1, B2>(
        low: B1,
        high: B2,
        rng: &mut R
    ) -> Self::X
    where
        B1: SampleBorrow<Self::X> + Sized,
        B2: SampleBorrow<Self::X> + Sized
, - { ... } -}
Expand description

Helper trait handling actual uniform sampling.

-

See the module documentation on how to implement Uniform range -sampling for a custom type.

-

Implementation of sample_single is optional, and is only useful when -the implementation can be faster than Self::new(low, high).sample(rng).

-

Required Associated Types

The type sampled by this implementation.

-

Required Methods

Construct self, with inclusive lower bound and exclusive upper bound -[low, high).

-

Usually users should not call this directly but instead use -Uniform::new, which asserts that low < high before calling this.

-

Construct self, with inclusive bounds [low, high].

-

Usually users should not call this directly but instead use -Uniform::new_inclusive, which asserts that low <= high before -calling this.

-

Sample a value.

-

Provided Methods

Sample a single value uniformly from a range with inclusive lower bound -and exclusive upper bound [low, high).

-

By default this is implemented using -UniformSampler::new(low, high).sample(rng). However, for some types -more optimal implementations for single usage may be provided via this -method (which is the case for integers and floats). -Results may not be identical.

-

Note that to use this method in a generic context, the type needs to be -retrieved via SampleUniform::Sampler as follows:

- -
use rand::{thread_rng, distributions::uniform::{SampleUniform, UniformSampler}};
-fn sample_from_range<T: SampleUniform>(lb: T, ub: T) -> T {
-    let mut rng = thread_rng();
-    <T as SampleUniform>::Sampler::sample_single(lb, ub, &mut rng)
-}
-

Sample a single value uniformly from a range with inclusive lower bound -and inclusive upper bound [low, high].

-

By default this is implemented using -UniformSampler::new_inclusive(low, high).sample(rng). However, for -some types more optimal implementations for single usage may be provided -via this method. -Results may not be identical.

-

Implementors

\ No newline at end of file diff --git a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/weighted/alias_method/index.html b/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/weighted/alias_method/index.html deleted file mode 100644 index 3b0024a..0000000 --- a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/weighted/alias_method/index.html +++ /dev/null @@ -1,2 +0,0 @@ -rand::distributions::weighted::alias_method - Rust
👎Deprecated since 0.8.0: moved to rand_distr crate

Structs

WeightedIndexDeprecated

Traits

WeightDeprecated
\ No newline at end of file diff --git a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/weighted/alias_method/sidebar-items.js b/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/weighted/alias_method/sidebar-items.js deleted file mode 100644 index ebb3179..0000000 --- a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/weighted/alias_method/sidebar-items.js +++ /dev/null @@ -1 +0,0 @@ -window.SIDEBAR_ITEMS = {"struct":[["WeightedIndex",""]],"trait":[["Weight",""]]}; \ No newline at end of file diff --git a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/weighted/alias_method/struct.WeightedIndex.html b/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/weighted/alias_method/struct.WeightedIndex.html deleted file mode 100644 index d537635..0000000 --- a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/weighted/alias_method/struct.WeightedIndex.html +++ /dev/null @@ -1,6 +0,0 @@ -WeightedIndex in rand::distributions::weighted::alias_method - Rust
pub struct WeightedIndex<W: Weight> { /* private fields */ }
👎Deprecated since 0.8.0: moved to rand_distr crate

Implementations

👎Deprecated since 0.8.0: moved to rand_distr crate

Trait Implementations

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

-

Calls U::from(self).

-

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/weighted/alias_method/trait.Weight.html b/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/weighted/alias_method/trait.Weight.html deleted file mode 100644 index a528442..0000000 --- a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/weighted/alias_method/trait.Weight.html +++ /dev/null @@ -1,2 +0,0 @@ -Weight in rand::distributions::weighted::alias_method - Rust
pub trait Weight { }
👎Deprecated since 0.8.0: moved to rand_distr crate

Implementations on Foreign Types

Implementors

\ No newline at end of file diff --git a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/weighted/enum.WeightedError.html b/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/weighted/enum.WeightedError.html deleted file mode 100644 index ba1bd6d..0000000 --- a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/weighted/enum.WeightedError.html +++ /dev/null @@ -1,20 +0,0 @@ -WeightedError in rand::distributions::weighted - Rust
pub enum WeightedError {
-    NoItem,
-    InvalidWeight,
-    AllWeightsZero,
-    TooMany,
-}
Expand description

Error type returned from WeightedIndex::new.

-

Variants

NoItem

The provided weight collection contains no items.

-

InvalidWeight

A weight is either less than zero, greater than the supported maximum, -NaN, or otherwise invalid.

-

AllWeightsZero

All items in the provided weight collection are zero.

-

TooMany

Too many weights are provided (length greater than u32::MAX)

-

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Formats the value using the given formatter. Read more
The lower-level source of this error, if any. Read more
👎Deprecated since 1.42.0: use the Display impl or to_string()
👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type based access to context intended for error reports. Read more
This method tests for self and other values to be equal, and is used -by ==. Read more
This method tests for !=. The default implementation is almost always -sufficient, and should not be overridden without very good reason. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

-

Calls U::from(self).

-

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-
🔬This is a nightly-only experimental API. (provide_any)
Data providers should implement this method to provide all values they are able to -provide by using demand. Read more
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
Converts the given value to a String. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/weighted/index.html b/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/weighted/index.html deleted file mode 100644 index 89f22ce..0000000 --- a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/weighted/index.html +++ /dev/null @@ -1,5 +0,0 @@ -rand::distributions::weighted - Rust
👎Deprecated since 0.8.0: use rand::distributions::{WeightedIndex, WeightedError} instead
Expand description

Weighted index sampling

-

This module is deprecated. Use crate::distributions::WeightedIndex and -crate::distributions::WeightedError instead.

-

Modules

alias_methodDeprecated

Structs

A distribution using weighted sampling of discrete items

Enums

Error type returned from WeightedIndex::new.
\ No newline at end of file diff --git a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/weighted/sidebar-items.js b/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/weighted/sidebar-items.js deleted file mode 100644 index 622d089..0000000 --- a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/weighted/sidebar-items.js +++ /dev/null @@ -1 +0,0 @@ -window.SIDEBAR_ITEMS = {"enum":[["WeightedError","Error type returned from `WeightedIndex::new`."]],"mod":[["alias_method",""]],"struct":[["WeightedIndex","A distribution using weighted sampling of discrete items"]]}; \ No newline at end of file diff --git a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/weighted/struct.WeightedIndex.html b/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/weighted/struct.WeightedIndex.html deleted file mode 100644 index e9c39d2..0000000 --- a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/weighted/struct.WeightedIndex.html +++ /dev/null @@ -1,63 +0,0 @@ -WeightedIndex in rand::distributions::weighted - Rust
pub struct WeightedIndex<X: SampleUniform + PartialOrd> { /* private fields */ }
Expand description

A distribution using weighted sampling of discrete items

-

Sampling a WeightedIndex distribution returns the index of a randomly -selected element from the iterator used when the WeightedIndex was -created. The chance of a given element being picked is proportional to the -value of the element. The weights can use any type X for which an -implementation of Uniform<X> exists.

-

Performance

-

Time complexity of sampling from WeightedIndex is O(log N) where -N is the number of weights. As an alternative, -rand_distr::weighted_alias -supports O(1) sampling, but with much higher initialisation cost.

-

A WeightedIndex<X> contains a Vec<X> and a Uniform<X> and so its -size is the sum of the size of those objects, possibly plus some alignment.

-

Creating a WeightedIndex<X> will allocate enough space to hold N - 1 -weights of type X, where N is the number of weights. However, since -Vec doesn’t guarantee a particular growth strategy, additional memory -might be allocated but not used. Since the WeightedIndex object also -contains, this might cause additional allocations, though for primitive -types, Uniform<X> doesn’t allocate any memory.

-

Sampling from WeightedIndex will result in a single call to -Uniform<X>::sample (method of the Distribution trait), which typically -will request a single value from the underlying RngCore, though the -exact number depends on the implementation of Uniform<X>::sample.

-

Example

-
use rand::prelude::*;
-use rand::distributions::WeightedIndex;
-
-let choices = ['a', 'b', 'c'];
-let weights = [2,   1,   1];
-let dist = WeightedIndex::new(&weights).unwrap();
-let mut rng = thread_rng();
-for _ in 0..100 {
-    // 50% chance to print 'a', 25% chance to print 'b', 25% chance to print 'c'
-    println!("{}", choices[dist.sample(&mut rng)]);
-}
-
-let items = [('a', 0), ('b', 3), ('c', 7)];
-let dist2 = WeightedIndex::new(items.iter().map(|item| item.1)).unwrap();
-for _ in 0..100 {
-    // 0% chance to print 'a', 30% chance to print 'b', 70% chance to print 'c'
-    println!("{}", items[dist2.sample(&mut rng)].0);
-}
-

Implementations

Creates a new a WeightedIndex Distribution using the values -in weights. The weights can use any type X for which an -implementation of Uniform<X> exists.

-

Returns an error if the iterator is empty, if any weight is < 0, or -if its total value is 0.

-

Update a subset of weights, without changing the number of weights.

-

new_weights must be sorted by the index.

-

Using this method instead of new might be more efficient if only a small number of -weights is modified. No allocations are performed, unless the weight type X uses -allocation internally.

-

In case of error, self is not modified.

-

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Generate a random value of T, using rng as the source of randomness.
Create an iterator that generates random values of T, using rng as -the source of randomness. Read more
Create a distribution of values of ‘S’ by mapping the output of Self -through the closure F Read more
This method tests for self and other values to be equal, and is used -by ==. Read more
This method tests for !=. The default implementation is almost always -sufficient, and should not be overridden without very good reason. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

-

Calls U::from(self).

-

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/weighted_index/enum.WeightedError.html b/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/weighted_index/enum.WeightedError.html deleted file mode 100644 index 443db1b..0000000 --- a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/weighted_index/enum.WeightedError.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - - Redirection - - -

Redirecting to ../../../rand/distributions/weighted/enum.WeightedError.html...

- - - \ No newline at end of file diff --git a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/weighted_index/struct.WeightedIndex.html b/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/weighted_index/struct.WeightedIndex.html deleted file mode 100644 index b314936..0000000 --- a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions/weighted_index/struct.WeightedIndex.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - - Redirection - - -

Redirecting to ../../../rand/distributions/weighted/struct.WeightedIndex.html...

- - - \ No newline at end of file diff --git a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/fn.random.html b/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/fn.random.html deleted file mode 100644 index 804c25d..0000000 --- a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/fn.random.html +++ /dev/null @@ -1,60 +0,0 @@ -random in rand - Rust

Function rand::random

source · []
pub fn random<T>() -> Twhere
    Standard: Distribution<T>,
Expand description

Generates a random value using the thread-local random number generator.

-

This is simply a shortcut for thread_rng().gen(). See thread_rng for -documentation of the entropy source and Standard for documentation of -distributions and type-specific generation.

-

Provided implementations

-

The following types have provided implementations that -generate values with the following ranges and distributions:

-
    -
  • Integers (i32, u32, isize, usize, etc.): Uniformly distributed -over all values of the type.
  • -
  • char: Uniformly distributed over all Unicode scalar values, i.e. all -code points in the range 0...0x10_FFFF, except for the range -0xD800...0xDFFF (the surrogate code points). This includes -unassigned/reserved code points.
  • -
  • bool: Generates false or true, each with probability 0.5.
  • -
  • Floating point types (f32 and f64): Uniformly distributed in the -half-open range [0, 1). See notes below.
  • -
  • Wrapping integers (Wrapping<T>), besides the type identical to their -normal integer variants.
  • -
-

Also supported is the generation of the following -compound types where all component types are supported:

-
    -
  • Tuples (up to 12 elements): each element is generated sequentially.
  • -
  • Arrays (up to 32 elements): each element is generated sequentially; -see also Rng::fill which supports arbitrary array length for integer -types and tends to be faster for u32 and smaller types.
  • -
  • Option<T> first generates a bool, and if true generates and returns -Some(value) where value: T, otherwise returning None.
  • -
-

Examples

-
let x = rand::random::<u8>();
-println!("{}", x);
-
-let y = rand::random::<f64>();
-println!("{}", y);
-
-if rand::random() { // generates a boolean
-    println!("Better lucky than good!");
-}
-

If you’re calling random() in a loop, caching the generator as in the -following example can increase performance.

- -
use rand::Rng;
-
-let mut v = vec![1, 2, 3];
-
-for x in v.iter_mut() {
-    *x = rand::random()
-}
-
-// can be made faster by caching thread_rng
-
-let mut rng = rand::thread_rng();
-
-for x in v.iter_mut() {
-    *x = rng.gen();
-}
-
\ No newline at end of file diff --git a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/fn.thread_rng.html b/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/fn.thread_rng.html deleted file mode 100644 index b620c7f..0000000 --- a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/fn.thread_rng.html +++ /dev/null @@ -1,8 +0,0 @@ -thread_rng in rand - Rust
pub fn thread_rng() -> ThreadRng
Expand description

Retrieve the lazily-initialized thread-local random number generator, -seeded by the system. Intended to be used in method chaining style, -e.g. thread_rng().gen::<i32>(), or cached locally, e.g. -let mut rng = thread_rng();. Invoked by the Default trait, making -ThreadRng::default() equivalent.

-

For more information see ThreadRng.

-
\ No newline at end of file diff --git a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/index.html b/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/index.html deleted file mode 100644 index 07aa415..0000000 --- a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/index.html +++ /dev/null @@ -1,33 +0,0 @@ -rand - Rust

Crate rand

source · []
Expand description

Utilities for random number generation

-

Rand provides utilities to generate random numbers, to convert them to -useful types and distributions, and some randomness-related algorithms.

-

Quick Start

-

To get you started quickly, the easiest and highest-level way to get -a random value is to use random(); alternatively you can use -thread_rng(). The Rng trait provides a useful API on all RNGs, while -the distributions and seq modules provide further -functionality on top of RNGs.

- -
use rand::prelude::*;
-
-if rand::random() { // generates a boolean
-    // Try printing a random unicode code point (probably a bad idea)!
-    println!("char: {}", rand::random::<char>());
-}
-
-let mut rng = rand::thread_rng();
-let y: f64 = rng.gen(); // generates a float between 0 and 1
-
-let mut nums: Vec<i32> = (1..100).collect();
-nums.shuffle(&mut rng);
-

The Book

-

For the user guide and further documentation, please read -The Rust Rand Book.

-

Modules

Generating random samples from probability distributions
Convenience re-export of common members
Random number generators and adapters
Sequence-related functionality

Structs

Error type of random number generators

Traits

A marker trait used to indicate that an RngCore or BlockRngCore -implementation is supposed to be cryptographically secure.
Types which may be filled with random data
An automatically-implemented extension trait on RngCore providing high-level -generic methods for sampling values and other convenience methods.
The core of a random number generator.
A random number generator that can be explicitly seeded.

Functions

Generates a random value using the thread-local random number generator.
Retrieve the lazily-initialized thread-local random number generator, -seeded by the system. Intended to be used in method chaining style, -e.g. thread_rng().gen::<i32>(), or cached locally, e.g. -let mut rng = thread_rng();. Invoked by the Default trait, making -ThreadRng::default() equivalent.
\ No newline at end of file diff --git a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/prelude/index.html b/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/prelude/index.html deleted file mode 100644 index 967c0a8..0000000 --- a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/prelude/index.html +++ /dev/null @@ -1,8 +0,0 @@ -rand::prelude - Rust
Expand description

Convenience re-export of common members

-

Like the standard library’s prelude, this module simplifies importing of -common items. Unlike the standard prelude, the contents of this module must -be imported manually:

- -
use rand::prelude::*;
-

Re-exports

pub use crate::distributions::Distribution;
pub use crate::rngs::StdRng;
pub use crate::rngs::ThreadRng;
pub use crate::seq::IteratorRandom;
pub use crate::seq::SliceRandom;
pub use crate::random;
pub use crate::thread_rng;
pub use crate::CryptoRng;
pub use crate::Rng;
pub use crate::RngCore;
pub use crate::SeedableRng;
\ No newline at end of file diff --git a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/prelude/sidebar-items.js b/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/prelude/sidebar-items.js deleted file mode 100644 index 5244ce0..0000000 --- a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/prelude/sidebar-items.js +++ /dev/null @@ -1 +0,0 @@ -window.SIDEBAR_ITEMS = {}; \ No newline at end of file diff --git a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/rng/trait.Fill.html b/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/rng/trait.Fill.html deleted file mode 100644 index 4cefa34..0000000 --- a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/rng/trait.Fill.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - - Redirection - - -

Redirecting to ../../rand/trait.Fill.html...

- - - \ No newline at end of file diff --git a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/rng/trait.Rng.html b/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/rng/trait.Rng.html deleted file mode 100644 index ab52aab..0000000 --- a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/rng/trait.Rng.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - - Redirection - - -

Redirecting to ../../rand/trait.Rng.html...

- - - \ No newline at end of file diff --git a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/rngs/adapter/index.html b/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/rngs/adapter/index.html deleted file mode 100644 index 0851869..0000000 --- a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/rngs/adapter/index.html +++ /dev/null @@ -1,5 +0,0 @@ -rand::rngs::adapter - Rust
Expand description

Wrappers / adapters forming RNGs

-

Structs

ReadErrorDeprecated
ReadRng error type
ReadRngDeprecated
An RNG that reads random bytes straight from any type supporting -std::io::Read, for example files.
A wrapper around any PRNG that implements BlockRngCore, that adds the -ability to reseed it.
\ No newline at end of file diff --git a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/rngs/adapter/read/struct.ReadError.html b/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/rngs/adapter/read/struct.ReadError.html deleted file mode 100644 index 47e82f7..0000000 --- a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/rngs/adapter/read/struct.ReadError.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - - Redirection - - -

Redirecting to ../../../../rand/rngs/adapter/struct.ReadError.html...

- - - \ No newline at end of file diff --git a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/rngs/adapter/read/struct.ReadRng.html b/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/rngs/adapter/read/struct.ReadRng.html deleted file mode 100644 index 4b28717..0000000 --- a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/rngs/adapter/read/struct.ReadRng.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - - Redirection - - -

Redirecting to ../../../../rand/rngs/adapter/struct.ReadRng.html...

- - - \ No newline at end of file diff --git a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/rngs/adapter/reseeding/struct.ReseedingRng.html b/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/rngs/adapter/reseeding/struct.ReseedingRng.html deleted file mode 100644 index a8ab2b3..0000000 --- a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/rngs/adapter/reseeding/struct.ReseedingRng.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - - Redirection - - -

Redirecting to ../../../../rand/rngs/adapter/struct.ReseedingRng.html...

- - - \ No newline at end of file diff --git a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/rngs/adapter/sidebar-items.js b/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/rngs/adapter/sidebar-items.js deleted file mode 100644 index 8c43fd4..0000000 --- a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/rngs/adapter/sidebar-items.js +++ /dev/null @@ -1 +0,0 @@ -window.SIDEBAR_ITEMS = {"struct":[["ReadError","`ReadRng` error type"],["ReadRng","An RNG that reads random bytes straight from any type supporting [`std::io::Read`], for example files."],["ReseedingRng","A wrapper around any PRNG that implements `BlockRngCore`, that adds the ability to reseed it."]]}; \ No newline at end of file diff --git a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/rngs/adapter/struct.ReadError.html b/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/rngs/adapter/struct.ReadError.html deleted file mode 100644 index 6f8c745..0000000 --- a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/rngs/adapter/struct.ReadError.html +++ /dev/null @@ -1,8 +0,0 @@ -ReadError in rand::rngs::adapter - Rust
pub struct ReadError(_);
👎Deprecated since 0.8.4
Expand description

ReadRng error type

-

Trait Implementations

Formats the value using the given formatter. Read more
Formats the value using the given formatter. Read more
The lower-level source of this error, if any. Read more
👎Deprecated since 1.42.0: use the Display impl or to_string()
👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type based access to context intended for error reports. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

-

Calls U::from(self).

-

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-
🔬This is a nightly-only experimental API. (provide_any)
Data providers should implement this method to provide all values they are able to -provide by using demand. Read more
Converts the given value to a String. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/rngs/adapter/struct.ReadRng.html b/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/rngs/adapter/struct.ReadRng.html deleted file mode 100644 index 304265d..0000000 --- a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/rngs/adapter/struct.ReadRng.html +++ /dev/null @@ -1,17 +0,0 @@ -ReadRng in rand::rngs::adapter - Rust
pub struct ReadRng<R> { /* private fields */ }
👎Deprecated since 0.8.4: removal due to lack of usage
Expand description

An RNG that reads random bytes straight from any type supporting -std::io::Read, for example files.

-

This will work best with an infinite reader, but that is not required.

-

This can be used with /dev/urandom on Unix but it is recommended to use -OsRng instead.

-

Panics

-

ReadRng uses std::io::Read::read_exact, which retries on interrupts. -All other errors from the underlying reader, including when it does not -have enough data, will only be reported through try_fill_bytes. -The other RngCore methods will panic in case of an error.

-

Implementations

Create a new ReadRng from a Read.

-

Trait Implementations

Formats the value using the given formatter. Read more
Return the next random u32. Read more
Return the next random u64. Read more
Fill dest with random data. Read more
Fill dest entirely with random data. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

-

Calls U::from(self).

-

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/rngs/adapter/struct.ReseedingRng.html b/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/rngs/adapter/struct.ReseedingRng.html deleted file mode 100644 index 132e1d3..0000000 --- a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/rngs/adapter/struct.ReseedingRng.html +++ /dev/null @@ -1,61 +0,0 @@ -ReseedingRng in rand::rngs::adapter - Rust
pub struct ReseedingRng<R, Rsdr>(_)
where
    R: BlockRngCore + SeedableRng,
    Rsdr: RngCore
;
Expand description

A wrapper around any PRNG that implements BlockRngCore, that adds the -ability to reseed it.

-

ReseedingRng reseeds the underlying PRNG in the following cases:

-
    -
  • On a manual call to reseed().
  • -
  • After clone(), the clone will be reseeded on first use.
  • -
  • When a process is forked on UNIX, the RNGs in both the parent and child -processes will be reseeded just before the next call to -BlockRngCore::generate, i.e. “soon”. For ChaCha and Hc128 this is a -maximum of fifteen u32 values before reseeding.
  • -
  • After the PRNG has generated a configurable number of random bytes.
  • -
-

When should reseeding after a fixed number of generated bytes be used?

-

Reseeding after a fixed number of generated bytes is never strictly -necessary. Cryptographic PRNGs don’t have a limited number of bytes they -can output, or at least not a limit reachable in any practical way. There is -no such thing as ‘running out of entropy’.

-

Occasionally reseeding can be seen as some form of ‘security in depth’. Even -if in the future a cryptographic weakness is found in the CSPRNG being used, -or a flaw in the implementation, occasionally reseeding should make -exploiting it much more difficult or even impossible.

-

Use ReseedingRng::new with a threshold of 0 to disable reseeding -after a fixed number of generated bytes.

-

Limitations

-

It is recommended that a ReseedingRng (including ThreadRng) not be used -from a fork handler. -Use OsRng or getrandom, or defer your use of the RNG until later.

-

Error handling

-

Although unlikely, reseeding the wrapped PRNG can fail. ReseedingRng will -never panic but try to handle the error intelligently through some -combination of retrying and delaying reseeding until later. -If handling the source error fails ReseedingRng will continue generating -data from the wrapped PRNG without reseeding.

-

Manually calling reseed() will not have this retry or delay logic, but -reports the error.

-

Example

-
use rand::prelude::*;
-use rand_chacha::ChaCha20Core; // Internal part of ChaChaRng that
-                             // implements BlockRngCore
-use rand::rngs::OsRng;
-use rand::rngs::adapter::ReseedingRng;
-
-let prng = ChaCha20Core::from_entropy();
-let mut reseeding_rng = ReseedingRng::new(prng, 0, OsRng);
-
-println!("{}", reseeding_rng.gen::<u64>());
-
-let mut cloned_rng = reseeding_rng.clone();
-assert!(reseeding_rng.gen::<u64>() != cloned_rng.gen::<u64>());
-

Implementations

Create a new ReseedingRng from an existing PRNG, combined with a RNG -to use as reseeder.

-

threshold sets the number of generated bytes after which to reseed the -PRNG. Set it to zero to never reseed based on the number of generated -values.

-

Reseed the internal PRNG.

-

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Return the next random u32. Read more
Return the next random u64. Read more
Fill dest with random data. Read more
Fill dest entirely with random data. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
Upcast to an RngCore trait object.

Returns the argument unchanged.

-

Calls U::from(self).

-

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/rngs/index.html b/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/rngs/index.html deleted file mode 100644 index da55743..0000000 --- a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/rngs/index.html +++ /dev/null @@ -1,73 +0,0 @@ -rand::rngs - Rust

Module rand::rngs

source · []
Expand description

Random number generators and adapters

-

Background: Random number generators (RNGs)

-

Computers cannot produce random numbers from nowhere. We classify -random number generators as follows:

-
    -
  • “True” random number generators (TRNGs) use hard-to-predict data sources -(e.g. the high-resolution parts of event timings and sensor jitter) to -harvest random bit-sequences, apply algorithms to remove bias and -estimate available entropy, then combine these bits into a byte-sequence -or an entropy pool. This job is usually done by the operating system or -a hardware generator (HRNG).
  • -
  • “Pseudo”-random number generators (PRNGs) use algorithms to transform a -seed into a sequence of pseudo-random numbers. These generators can be -fast and produce well-distributed unpredictable random numbers (or not). -They are usually deterministic: given algorithm and seed, the output -sequence can be reproduced. They have finite period and eventually loop; -with many algorithms this period is fixed and can be proven sufficiently -long, while others are chaotic and the period depends on the seed.
  • -
  • “Cryptographically secure” pseudo-random number generators (CSPRNGs) -are the sub-set of PRNGs which are secure. Security of the generator -relies both on hiding the internal state and using a strong algorithm.
  • -
-

Traits and functionality

-

All RNGs implement the RngCore trait, as a consequence of which the -Rng extension trait is automatically implemented. Secure RNGs may -additionally implement the CryptoRng trait.

-

All PRNGs require a seed to produce their random number sequence. The -SeedableRng trait provides three ways of constructing PRNGs:

-
    -
  • from_seed accepts a type specific to the PRNG
  • -
  • from_rng allows a PRNG to be seeded from any other RNG
  • -
  • seed_from_u64 allows any PRNG to be seeded from a u64 insecurely
  • -
  • from_entropy securely seeds a PRNG from fresh entropy
  • -
-

Use the rand_core crate when implementing your own RNGs.

-

Our generators

-

This crate provides several random number generators:

-
    -
  • OsRng is an interface to the operating system’s random number -source. Typically the operating system uses a CSPRNG with entropy -provided by a TRNG and some type of on-going re-seeding.
  • -
  • ThreadRng, provided by the thread_rng function, is a handle to a -thread-local CSPRNG with periodic seeding from OsRng. Because this -is local, it is typically much faster than OsRng. It should be -secure, though the paranoid may prefer OsRng.
  • -
  • StdRng is a CSPRNG chosen for good performance and trust of security -(based on reviews, maturity and usage). The current algorithm is ChaCha12, -which is well established and rigorously analysed. -StdRng provides the algorithm used by ThreadRng but without -periodic reseeding.
  • -
  • [SmallRng] is an insecure PRNG designed to be fast, simple, require -little memory, and have good output quality.
  • -
-

The algorithms selected for StdRng and [SmallRng] may change in any -release and may be platform-dependent, therefore they should be considered -not reproducible.

-

Additional generators

-

TRNGs: The rdrand crate provides an interface to the RDRAND and -RDSEED instructions available in modern Intel and AMD CPUs. -The rand_jitter crate provides a user-space implementation of -entropy harvesting from CPU timer jitter, but is very slow and has -security issues.

-

PRNGs: Several companion crates are available, providing individual or -families of PRNG algorithms. These provide the implementations behind -StdRng and [SmallRng] but can also be used directly, indeed should -be used directly when reproducibility matters. -Some suggestions are: rand_chacha, rand_pcg, rand_xoshiro. -A full list can be found by searching for crates with the rng tag.

-

Modules

Wrappers / adapters forming RNGs
Mock random number generator

Structs

A random number generator that retrieves randomness from the -operating system.
The standard RNG. The PRNG algorithm in StdRng is chosen to be efficient -on the current platform, to be statistically strong and unpredictable -(meaning a cryptographically secure PRNG).
A reference to the thread-local generator
\ No newline at end of file diff --git a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/rngs/mock/index.html b/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/rngs/mock/index.html deleted file mode 100644 index 49b4b05..0000000 --- a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/rngs/mock/index.html +++ /dev/null @@ -1,3 +0,0 @@ -rand::rngs::mock - Rust
Expand description

Mock random number generator

-

Structs

A simple implementation of RngCore for testing purposes.
\ No newline at end of file diff --git a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/rngs/mock/sidebar-items.js b/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/rngs/mock/sidebar-items.js deleted file mode 100644 index 9d448f0..0000000 --- a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/rngs/mock/sidebar-items.js +++ /dev/null @@ -1 +0,0 @@ -window.SIDEBAR_ITEMS = {"struct":[["StepRng","A simple implementation of `RngCore` for testing purposes."]]}; \ No newline at end of file diff --git a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/rngs/mock/struct.StepRng.html b/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/rngs/mock/struct.StepRng.html deleted file mode 100644 index 45140c5..0000000 --- a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/rngs/mock/struct.StepRng.html +++ /dev/null @@ -1,21 +0,0 @@ -StepRng in rand::rngs::mock - Rust
pub struct StepRng { /* private fields */ }
Expand description

A simple implementation of RngCore for testing purposes.

-

This generates an arithmetic sequence (i.e. adds a constant each step) -over a u64 number, using wrapping arithmetic. If the increment is 0 -the generator yields a constant.

- -
use rand::Rng;
-use rand::rngs::mock::StepRng;
-
-let mut my_rng = StepRng::new(2, 1);
-let sample: [u64; 3] = my_rng.gen();
-assert_eq!(sample, [2, 3, 4]);
-

Implementations

Create a StepRng, yielding an arithmetic sequence starting with -initial and incremented by increment each time.

-

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
This method tests for self and other values to be equal, and is used -by ==. Read more
This method tests for !=. The default implementation is almost always -sufficient, and should not be overridden without very good reason. Read more
Return the next random u32. Read more
Return the next random u64. Read more
Fill dest with random data. Read more
Fill dest entirely with random data. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

-

Calls U::from(self).

-

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/rngs/sidebar-items.js b/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/rngs/sidebar-items.js deleted file mode 100644 index 3c82c8d..0000000 --- a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/rngs/sidebar-items.js +++ /dev/null @@ -1 +0,0 @@ -window.SIDEBAR_ITEMS = {"mod":[["adapter","Wrappers / adapters forming RNGs"],["mock","Mock random number generator"]],"struct":[["OsRng","A random number generator that retrieves randomness from the operating system."],["StdRng","The standard RNG. The PRNG algorithm in `StdRng` is chosen to be efficient on the current platform, to be statistically strong and unpredictable (meaning a cryptographically secure PRNG)."],["ThreadRng","A reference to the thread-local generator"]]}; \ No newline at end of file diff --git a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/rngs/std/struct.StdRng.html b/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/rngs/std/struct.StdRng.html deleted file mode 100644 index 6b6b668..0000000 --- a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/rngs/std/struct.StdRng.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - - Redirection - - -

Redirecting to ../../../rand/rngs/struct.StdRng.html...

- - - \ No newline at end of file diff --git a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/rngs/struct.OsRng.html b/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/rngs/struct.OsRng.html deleted file mode 100644 index 821dd5f..0000000 --- a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/rngs/struct.OsRng.html +++ /dev/null @@ -1,27 +0,0 @@ -OsRng in rand::rngs - Rust
pub struct OsRng;
Expand description

A random number generator that retrieves randomness from the -operating system.

-

This is a zero-sized struct. It can be freely constructed with OsRng.

-

The implementation is provided by the getrandom crate. Refer to -getrandom documentation for details.

-

This struct is only available when specifying the crate feature getrandom -or std. When using the rand lib, it is also available as rand::rngs::OsRng.

-

Blocking and error handling

-

It is possible that when used during early boot the first call to OsRng -will block until the system’s RNG is initialised. It is also possible -(though highly unlikely) for OsRng to fail on some platforms, most -likely due to system mis-configuration.

-

After the first successful call, it is highly unlikely that failures or -significant delays will occur (although performance should be expected to -be much slower than a user-space PRNG).

-

Usage example

-
use rand_core::{RngCore, OsRng};
-
-let mut key = [0u8; 16];
-OsRng.fill_bytes(&mut key);
-let random_u64 = OsRng.next_u64();
-

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more
Return the next random u32. Read more
Return the next random u64. Read more
Fill dest with random data. Read more
Fill dest entirely with random data. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
Upcast to an RngCore trait object.

Returns the argument unchanged.

-

Calls U::from(self).

-

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/rngs/struct.StdRng.html b/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/rngs/struct.StdRng.html deleted file mode 100644 index 5faf216..0000000 --- a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/rngs/struct.StdRng.html +++ /dev/null @@ -1,19 +0,0 @@ -StdRng in rand::rngs - Rust
pub struct StdRng(_);
Expand description

The standard RNG. The PRNG algorithm in StdRng is chosen to be efficient -on the current platform, to be statistically strong and unpredictable -(meaning a cryptographically secure PRNG).

-

The current algorithm used is the ChaCha block cipher with 12 rounds. Please -see this relevant rand issue for the discussion. This may change as new -evidence of cipher security and performance becomes available.

-

The algorithm is deterministic but should not be considered reproducible -due to dependence on configuration and possible replacement in future -library versions. For a secure reproducible generator, we recommend use of -the rand_chacha crate directly.

-

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
This method tests for self and other values to be equal, and is used -by ==. Read more
This method tests for !=. The default implementation is almost always -sufficient, and should not be overridden without very good reason. Read more
Return the next random u32. Read more
Return the next random u64. Read more
Fill dest with random data. Read more
Fill dest entirely with random data. Read more
Seed type, which is restricted to types mutably-dereferenceable as u8 -arrays (we recommend [u8; N] for some N). Read more
Create a new PRNG using the given seed. Read more
Create a new PRNG seeded from another Rng. Read more
Create a new PRNG using a u64 seed. Read more
Creates a new instance of the RNG seeded via getrandom. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
Upcast to an RngCore trait object.

Returns the argument unchanged.

-

Calls U::from(self).

-

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/rngs/struct.ThreadRng.html b/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/rngs/struct.ThreadRng.html deleted file mode 100644 index f2e6783..0000000 --- a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/rngs/struct.ThreadRng.html +++ /dev/null @@ -1,20 +0,0 @@ -ThreadRng in rand::rngs - Rust
pub struct ThreadRng { /* private fields */ }
Expand description

A reference to the thread-local generator

-

An instance can be obtained via thread_rng or via ThreadRng::default(). -This handle is safe to use everywhere (including thread-local destructors), -though it is recommended not to use inside a fork handler. -The handle cannot be passed between threads (is not Send or Sync).

-

ThreadRng uses the same PRNG as StdRng for security and performance -and is automatically seeded from OsRng.

-

Unlike StdRng, ThreadRng uses the ReseedingRng wrapper to reseed -the PRNG from fresh entropy every 64 kiB of random data as well as after a -fork on Unix (though not quite immediately; see documentation of -ReseedingRng). -Note that the reseeding is done as an extra precaution against side-channel -attacks and mis-use (e.g. if somehow weak entropy were supplied initially). -The PRNG algorithms used are assumed to be secure.

-

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more
Return the next random u32. Read more
Return the next random u64. Read more
Fill dest with random data. Read more
Fill dest entirely with random data. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
Upcast to an RngCore trait object.

Returns the argument unchanged.

-

Calls U::from(self).

-

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/rngs/thread/fn.thread_rng.html b/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/rngs/thread/fn.thread_rng.html deleted file mode 100644 index fd6b38f..0000000 --- a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/rngs/thread/fn.thread_rng.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - - Redirection - - -

Redirecting to ../../../rand/fn.thread_rng.html...

- - - \ No newline at end of file diff --git a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/rngs/thread/struct.ThreadRng.html b/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/rngs/thread/struct.ThreadRng.html deleted file mode 100644 index f055ab8..0000000 --- a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/rngs/thread/struct.ThreadRng.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - - Redirection - - -

Redirecting to ../../../rand/rngs/struct.ThreadRng.html...

- - - \ No newline at end of file diff --git a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/seq/index.html b/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/seq/index.html deleted file mode 100644 index 7ae21e1..0000000 --- a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/seq/index.html +++ /dev/null @@ -1,18 +0,0 @@ -rand::seq - Rust

Module rand::seq

source · []
Expand description

Sequence-related functionality

-

This module provides:

- -

Also see:

- -

In order to make results reproducible across 32-64 bit architectures, all -usize indices are sampled as a u32 where possible (also providing a -small performance boost in some cases).

-

Modules

Low-level API for sampling indices

Structs

An iterator over multiple slice elements.

Traits

Extension trait on iterators, providing random sampling methods.
Extension trait on slices, providing random mutation and sampling methods.
\ No newline at end of file diff --git a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/seq/index/enum.IndexVec.html b/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/seq/index/enum.IndexVec.html deleted file mode 100644 index 06d7c47..0000000 --- a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/seq/index/enum.IndexVec.html +++ /dev/null @@ -1,20 +0,0 @@ -IndexVec in rand::seq::index - Rust
pub enum IndexVec {
-    // some variants omitted
-}
Expand description

A vector of indices.

-

Multiple internal representations are possible.

-

Implementations

Returns the number of indices

-

Returns true if the length is 0.

-

Return the value at the given index.

-

(Note: we cannot implement std::ops::Index because of lifetime -restrictions.)

-

Return result as a Vec<usize>. Conversion may or may not be trivial.

-

Iterate over the indices as a sequence of usize values

-

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Converts to this type from the input type.
Converts to this type from the input type.

Convert into an iterator over the indices as a sequence of usize values

-
The type of the elements being iterated over.
Which kind of iterator are we turning this into?
This method tests for self and other values to be equal, and is used -by ==. Read more
This method tests for !=. The default implementation is almost always -sufficient, and should not be overridden without very good reason. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

-

Calls U::from(self).

-

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/seq/index/enum.IndexVecIntoIter.html b/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/seq/index/enum.IndexVecIntoIter.html deleted file mode 100644 index 19752f9..0000000 --- a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/seq/index/enum.IndexVecIntoIter.html +++ /dev/null @@ -1,42 +0,0 @@ -IndexVecIntoIter in rand::seq::index - Rust
pub enum IndexVecIntoIter {
-    // some variants omitted
-}
Expand description

Return type of IndexVec::into_iter.

-

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Returns the exact remaining length of the iterator. Read more
🔬This is a nightly-only experimental API. (exact_size_is_empty)
Returns true if the iterator is empty. Read more
The type of the elements being iterated over.
Advances the iterator and returns the next value. Read more
Returns the bounds on the remaining length of the iterator. Read more
🔬This is a nightly-only experimental API. (iter_next_chunk)
Advances the iterator and returns an array containing the next N values. Read more
Consumes the iterator, counting the number of iterations and returning it. Read more
Consumes the iterator, returning the last element. Read more
🔬This is a nightly-only experimental API. (iter_advance_by)
Advances the iterator by n elements. Read more
Returns the nth element of the iterator. Read more
Creates an iterator starting at the same point, but stepping by -the given amount at each iteration. Read more
Takes two iterators and creates a new iterator over both in sequence. Read more
‘Zips up’ two iterators into a single iterator of pairs. Read more
🔬This is a nightly-only experimental API. (iter_intersperse)
Creates a new iterator which places an item generated by separator -between adjacent items of the original iterator. Read more
Takes a closure and creates an iterator which calls that closure on each -element. Read more
Calls a closure on each element of an iterator. Read more
Creates an iterator which uses a closure to determine if an element -should be yielded. Read more
Creates an iterator that both filters and maps. Read more
Creates an iterator which gives the current iteration count as well as -the next value. Read more
Creates an iterator which can use the peek and peek_mut methods -to look at the next element of the iterator without consuming it. See -their documentation for more information. Read more
Creates an iterator that skips elements based on a predicate. Read more
Creates an iterator that yields elements based on a predicate. Read more
Creates an iterator that both yields elements based on a predicate and maps. Read more
Creates an iterator that skips the first n elements. Read more
Creates an iterator that yields the first n elements, or fewer -if the underlying iterator ends sooner. Read more
An iterator adapter similar to fold that holds internal state and -produces a new iterator. Read more
Creates an iterator that works like map, but flattens nested structure. Read more
Creates an iterator which ends after the first None. Read more
Does something with each element of an iterator, passing the value on. Read more
Borrows an iterator, rather than consuming it. Read more
Transforms an iterator into a collection. Read more
🔬This is a nightly-only experimental API. (iter_collect_into)
Collects all the items from an iterator into a collection. Read more
Consumes an iterator, creating two collections from it. Read more
🔬This is a nightly-only experimental API. (iter_is_partitioned)
Checks if the elements of this iterator are partitioned according to the given predicate, -such that all those that return true precede all those that return false. Read more
An iterator method that applies a function as long as it returns -successfully, producing a single, final value. Read more
An iterator method that applies a fallible function to each item in the -iterator, stopping at the first error and returning that error. Read more
Folds every element into an accumulator by applying an operation, -returning the final result. Read more
Reduces the elements to a single one, by repeatedly applying a reducing -operation. Read more
🔬This is a nightly-only experimental API. (iterator_try_reduce)
Reduces the elements to a single one by repeatedly applying a reducing operation. If the -closure returns a failure, the failure is propagated back to the caller immediately. Read more
Tests if every element of the iterator matches a predicate. Read more
Tests if any element of the iterator matches a predicate. Read more
Searches for an element of an iterator that satisfies a predicate. Read more
Applies function to the elements of iterator and returns -the first non-none result. Read more
🔬This is a nightly-only experimental API. (try_find)
Applies function to the elements of iterator and returns -the first true result or the first error. Read more
Searches for an element in an iterator, returning its index. Read more
Returns the element that gives the maximum value from the -specified function. Read more
Returns the element that gives the maximum value with respect to the -specified comparison function. Read more
Returns the element that gives the minimum value from the -specified function. Read more
Returns the element that gives the minimum value with respect to the -specified comparison function. Read more
Converts an iterator of pairs into a pair of containers. Read more
Creates an iterator which copies all of its elements. Read more
Creates an iterator which clones all of its elements. Read more
Repeats an iterator endlessly. Read more
🔬This is a nightly-only experimental API. (iter_array_chunks)
Returns an iterator over N elements of the iterator at a time. Read more
Sums the elements of an iterator. Read more
Iterates over the entire iterator, multiplying all the elements Read more
🔬This is a nightly-only experimental API. (iter_order_by)
Lexicographically compares the elements of this Iterator with those -of another with respect to the specified comparison function. Read more
Lexicographically compares the elements of this Iterator with those -of another. Read more
🔬This is a nightly-only experimental API. (iter_order_by)
Lexicographically compares the elements of this Iterator with those -of another with respect to the specified comparison function. Read more
Determines if the elements of this Iterator are equal to those of -another. Read more
🔬This is a nightly-only experimental API. (iter_order_by)
Determines if the elements of this Iterator are equal to those of -another with respect to the specified equality function. Read more
Determines if the elements of this Iterator are unequal to those of -another. Read more
Determines if the elements of this Iterator are lexicographically -less than those of another. Read more
Determines if the elements of this Iterator are lexicographically -less or equal to those of another. Read more
Determines if the elements of this Iterator are lexicographically -greater than those of another. Read more
Determines if the elements of this Iterator are lexicographically -greater than or equal to those of another. Read more
🔬This is a nightly-only experimental API. (is_sorted)
Checks if the elements of this iterator are sorted using the given comparator function. Read more
🔬This is a nightly-only experimental API. (is_sorted)
Checks if the elements of this iterator are sorted using the given key extraction -function. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

-

Calls U::from(self).

-

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-
The type of the elements being iterated over.
Which kind of iterator are we turning this into?
Creates an iterator from a value. Read more
Choose one element at random from the iterator. Read more
Choose one element at random from the iterator. Read more
Collects values at random from the iterator into a supplied buffer -until that buffer is filled. Read more
Collects amount values at random from the iterator into a vector. Read more
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/seq/index/enum.IndexVecIter.html b/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/seq/index/enum.IndexVecIter.html deleted file mode 100644 index 9fbd29c..0000000 --- a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/seq/index/enum.IndexVecIter.html +++ /dev/null @@ -1,42 +0,0 @@ -IndexVecIter in rand::seq::index - Rust
pub enum IndexVecIter<'a> {
-    // some variants omitted
-}
Expand description

Return type of IndexVec::iter.

-

Trait Implementations

Formats the value using the given formatter. Read more
Returns the exact remaining length of the iterator. Read more
🔬This is a nightly-only experimental API. (exact_size_is_empty)
Returns true if the iterator is empty. Read more
The type of the elements being iterated over.
Advances the iterator and returns the next value. Read more
Returns the bounds on the remaining length of the iterator. Read more
🔬This is a nightly-only experimental API. (iter_next_chunk)
Advances the iterator and returns an array containing the next N values. Read more
Consumes the iterator, counting the number of iterations and returning it. Read more
Consumes the iterator, returning the last element. Read more
🔬This is a nightly-only experimental API. (iter_advance_by)
Advances the iterator by n elements. Read more
Returns the nth element of the iterator. Read more
Creates an iterator starting at the same point, but stepping by -the given amount at each iteration. Read more
Takes two iterators and creates a new iterator over both in sequence. Read more
‘Zips up’ two iterators into a single iterator of pairs. Read more
🔬This is a nightly-only experimental API. (iter_intersperse)
Creates a new iterator which places an item generated by separator -between adjacent items of the original iterator. Read more
Takes a closure and creates an iterator which calls that closure on each -element. Read more
Calls a closure on each element of an iterator. Read more
Creates an iterator which uses a closure to determine if an element -should be yielded. Read more
Creates an iterator that both filters and maps. Read more
Creates an iterator which gives the current iteration count as well as -the next value. Read more
Creates an iterator which can use the peek and peek_mut methods -to look at the next element of the iterator without consuming it. See -their documentation for more information. Read more
Creates an iterator that skips elements based on a predicate. Read more
Creates an iterator that yields elements based on a predicate. Read more
Creates an iterator that both yields elements based on a predicate and maps. Read more
Creates an iterator that skips the first n elements. Read more
Creates an iterator that yields the first n elements, or fewer -if the underlying iterator ends sooner. Read more
An iterator adapter similar to fold that holds internal state and -produces a new iterator. Read more
Creates an iterator that works like map, but flattens nested structure. Read more
Creates an iterator which ends after the first None. Read more
Does something with each element of an iterator, passing the value on. Read more
Borrows an iterator, rather than consuming it. Read more
Transforms an iterator into a collection. Read more
🔬This is a nightly-only experimental API. (iter_collect_into)
Collects all the items from an iterator into a collection. Read more
Consumes an iterator, creating two collections from it. Read more
🔬This is a nightly-only experimental API. (iter_is_partitioned)
Checks if the elements of this iterator are partitioned according to the given predicate, -such that all those that return true precede all those that return false. Read more
An iterator method that applies a function as long as it returns -successfully, producing a single, final value. Read more
An iterator method that applies a fallible function to each item in the -iterator, stopping at the first error and returning that error. Read more
Folds every element into an accumulator by applying an operation, -returning the final result. Read more
Reduces the elements to a single one, by repeatedly applying a reducing -operation. Read more
🔬This is a nightly-only experimental API. (iterator_try_reduce)
Reduces the elements to a single one by repeatedly applying a reducing operation. If the -closure returns a failure, the failure is propagated back to the caller immediately. Read more
Tests if every element of the iterator matches a predicate. Read more
Tests if any element of the iterator matches a predicate. Read more
Searches for an element of an iterator that satisfies a predicate. Read more
Applies function to the elements of iterator and returns -the first non-none result. Read more
🔬This is a nightly-only experimental API. (try_find)
Applies function to the elements of iterator and returns -the first true result or the first error. Read more
Searches for an element in an iterator, returning its index. Read more
Returns the element that gives the maximum value from the -specified function. Read more
Returns the element that gives the maximum value with respect to the -specified comparison function. Read more
Returns the element that gives the minimum value from the -specified function. Read more
Returns the element that gives the minimum value with respect to the -specified comparison function. Read more
Converts an iterator of pairs into a pair of containers. Read more
Creates an iterator which copies all of its elements. Read more
Creates an iterator which clones all of its elements. Read more
🔬This is a nightly-only experimental API. (iter_array_chunks)
Returns an iterator over N elements of the iterator at a time. Read more
Sums the elements of an iterator. Read more
Iterates over the entire iterator, multiplying all the elements Read more
🔬This is a nightly-only experimental API. (iter_order_by)
Lexicographically compares the elements of this Iterator with those -of another with respect to the specified comparison function. Read more
Lexicographically compares the elements of this Iterator with those -of another. Read more
🔬This is a nightly-only experimental API. (iter_order_by)
Lexicographically compares the elements of this Iterator with those -of another with respect to the specified comparison function. Read more
Determines if the elements of this Iterator are equal to those of -another. Read more
🔬This is a nightly-only experimental API. (iter_order_by)
Determines if the elements of this Iterator are equal to those of -another with respect to the specified equality function. Read more
Determines if the elements of this Iterator are unequal to those of -another. Read more
Determines if the elements of this Iterator are lexicographically -less than those of another. Read more
Determines if the elements of this Iterator are lexicographically -less or equal to those of another. Read more
Determines if the elements of this Iterator are lexicographically -greater than those of another. Read more
Determines if the elements of this Iterator are lexicographically -greater than or equal to those of another. Read more
🔬This is a nightly-only experimental API. (is_sorted)
Checks if the elements of this iterator are sorted using the given comparator function. Read more
🔬This is a nightly-only experimental API. (is_sorted)
Checks if the elements of this iterator are sorted using the given key extraction -function. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

-

Calls U::from(self).

-

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-
The type of the elements being iterated over.
Which kind of iterator are we turning this into?
Creates an iterator from a value. Read more
Choose one element at random from the iterator. Read more
Choose one element at random from the iterator. Read more
Collects values at random from the iterator into a supplied buffer -until that buffer is filled. Read more
Collects amount values at random from the iterator into a vector. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/seq/index/fn.sample.html b/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/seq/index/fn.sample.html deleted file mode 100644 index 54c0197..0000000 --- a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/seq/index/fn.sample.html +++ /dev/null @@ -1,19 +0,0 @@ -sample in rand::seq::index - Rust
pub fn sample<R>(rng: &mut R, length: usize, amount: usize) -> IndexVecwhere
    R: Rng + ?Sized,
Expand description

Randomly sample exactly amount distinct indices from 0..length, and -return them in random order (fully shuffled).

-

This method is used internally by the slice sampling methods, but it can -sometimes be useful to have the indices themselves so this is provided as -an alternative.

-

The implementation used is not specified; we automatically select the -fastest available algorithm for the length and amount parameters -(based on detailed profiling on an Intel Haswell CPU). Roughly speaking, -complexity is O(amount), except that when amount is small, performance -is closer to O(amount^2), and when length is close to amount then -O(length).

-

Note that performance is significantly better over u32 indices than over -u64 indices. Because of this we hide the underlying type behind an -abstraction, IndexVec.

-

If an allocation-free no_std function is required, it is suggested -to adapt the internal sample_floyd implementation.

-

Panics if amount > length.

-
\ No newline at end of file diff --git a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/seq/index/fn.sample_weighted.html b/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/seq/index/fn.sample_weighted.html deleted file mode 100644 index 2fc77d7..0000000 --- a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/seq/index/fn.sample_weighted.html +++ /dev/null @@ -1,13 +0,0 @@ -sample_weighted in rand::seq::index - Rust
pub fn sample_weighted<R, F, X>(
    rng: &mut R,
    length: usize,
    weight: F,
    amount: usize
) -> Result<IndexVec, WeightedError>where
    R: Rng + ?Sized,
    F: Fn(usize) -> X,
    X: Into<f64>,
Expand description

Randomly sample exactly amount distinct indices from 0..length, and -return them in an arbitrary order (there is no guarantee of shuffling or -ordering). The weights are to be provided by the input function weights, -which will be called once for each index.

-

This method is used internally by the slice sampling methods, but it can -sometimes be useful to have the indices themselves so this is provided as -an alternative.

-

This implementation uses O(length + amount) space and O(length) time -if the “nightly” feature is enabled, or O(length) space and -O(length + amount * log length) time otherwise.

-

Panics if amount > length.

-
\ No newline at end of file diff --git a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/seq/index/index.html b/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/seq/index/index.html deleted file mode 100644 index d4ca1c7..0000000 --- a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/seq/index/index.html +++ /dev/null @@ -1,7 +0,0 @@ -rand::seq::index - Rust
Expand description

Low-level API for sampling indices

-

Enums

A vector of indices.
Return type of IndexVec::into_iter.
Return type of IndexVec::iter.

Functions

Randomly sample exactly amount distinct indices from 0..length, and -return them in random order (fully shuffled).
Randomly sample exactly amount distinct indices from 0..length, and -return them in an arbitrary order (there is no guarantee of shuffling or -ordering). The weights are to be provided by the input function weights, -which will be called once for each index.
\ No newline at end of file diff --git a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/seq/index/sidebar-items.js b/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/seq/index/sidebar-items.js deleted file mode 100644 index e458a98..0000000 --- a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/seq/index/sidebar-items.js +++ /dev/null @@ -1 +0,0 @@ -window.SIDEBAR_ITEMS = {"enum":[["IndexVec","A vector of indices."],["IndexVecIntoIter","Return type of `IndexVec::into_iter`."],["IndexVecIter","Return type of `IndexVec::iter`."]],"fn":[["sample","Randomly sample exactly `amount` distinct indices from `0..length`, and return them in random order (fully shuffled)."],["sample_weighted","Randomly sample exactly `amount` distinct indices from `0..length`, and return them in an arbitrary order (there is no guarantee of shuffling or ordering). The weights are to be provided by the input function `weights`, which will be called once for each index."]]}; \ No newline at end of file diff --git a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/seq/sidebar-items.js b/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/seq/sidebar-items.js deleted file mode 100644 index 5a30717..0000000 --- a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/seq/sidebar-items.js +++ /dev/null @@ -1 +0,0 @@ -window.SIDEBAR_ITEMS = {"mod":[["index","Low-level API for sampling indices"]],"struct":[["SliceChooseIter","An iterator over multiple slice elements."]],"trait":[["IteratorRandom","Extension trait on iterators, providing random sampling methods."],["SliceRandom","Extension trait on slices, providing random mutation and sampling methods."]]}; \ No newline at end of file diff --git a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/seq/struct.SliceChooseIter.html b/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/seq/struct.SliceChooseIter.html deleted file mode 100644 index a0f84e7..0000000 --- a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/seq/struct.SliceChooseIter.html +++ /dev/null @@ -1,42 +0,0 @@ -SliceChooseIter in rand::seq - Rust
pub struct SliceChooseIter<'a, S: ?Sized + 'a, T: 'a> { /* private fields */ }
Expand description

An iterator over multiple slice elements.

-

This struct is created by -SliceRandom::choose_multiple.

-

Trait Implementations

Formats the value using the given formatter. Read more
Returns the exact remaining length of the iterator. Read more
🔬This is a nightly-only experimental API. (exact_size_is_empty)
Returns true if the iterator is empty. Read more
The type of the elements being iterated over.
Advances the iterator and returns the next value. Read more
Returns the bounds on the remaining length of the iterator. Read more
🔬This is a nightly-only experimental API. (iter_next_chunk)
Advances the iterator and returns an array containing the next N values. Read more
Consumes the iterator, counting the number of iterations and returning it. Read more
Consumes the iterator, returning the last element. Read more
🔬This is a nightly-only experimental API. (iter_advance_by)
Advances the iterator by n elements. Read more
Returns the nth element of the iterator. Read more
Creates an iterator starting at the same point, but stepping by -the given amount at each iteration. Read more
Takes two iterators and creates a new iterator over both in sequence. Read more
‘Zips up’ two iterators into a single iterator of pairs. Read more
🔬This is a nightly-only experimental API. (iter_intersperse)
Creates a new iterator which places an item generated by separator -between adjacent items of the original iterator. Read more
Takes a closure and creates an iterator which calls that closure on each -element. Read more
Calls a closure on each element of an iterator. Read more
Creates an iterator which uses a closure to determine if an element -should be yielded. Read more
Creates an iterator that both filters and maps. Read more
Creates an iterator which gives the current iteration count as well as -the next value. Read more
Creates an iterator which can use the peek and peek_mut methods -to look at the next element of the iterator without consuming it. See -their documentation for more information. Read more
Creates an iterator that skips elements based on a predicate. Read more
Creates an iterator that yields elements based on a predicate. Read more
Creates an iterator that both yields elements based on a predicate and maps. Read more
Creates an iterator that skips the first n elements. Read more
Creates an iterator that yields the first n elements, or fewer -if the underlying iterator ends sooner. Read more
An iterator adapter similar to fold that holds internal state and -produces a new iterator. Read more
Creates an iterator that works like map, but flattens nested structure. Read more
Creates an iterator which ends after the first None. Read more
Does something with each element of an iterator, passing the value on. Read more
Borrows an iterator, rather than consuming it. Read more
Transforms an iterator into a collection. Read more
🔬This is a nightly-only experimental API. (iter_collect_into)
Collects all the items from an iterator into a collection. Read more
Consumes an iterator, creating two collections from it. Read more
🔬This is a nightly-only experimental API. (iter_is_partitioned)
Checks if the elements of this iterator are partitioned according to the given predicate, -such that all those that return true precede all those that return false. Read more
An iterator method that applies a function as long as it returns -successfully, producing a single, final value. Read more
An iterator method that applies a fallible function to each item in the -iterator, stopping at the first error and returning that error. Read more
Folds every element into an accumulator by applying an operation, -returning the final result. Read more
Reduces the elements to a single one, by repeatedly applying a reducing -operation. Read more
🔬This is a nightly-only experimental API. (iterator_try_reduce)
Reduces the elements to a single one by repeatedly applying a reducing operation. If the -closure returns a failure, the failure is propagated back to the caller immediately. Read more
Tests if every element of the iterator matches a predicate. Read more
Tests if any element of the iterator matches a predicate. Read more
Searches for an element of an iterator that satisfies a predicate. Read more
Applies function to the elements of iterator and returns -the first non-none result. Read more
🔬This is a nightly-only experimental API. (try_find)
Applies function to the elements of iterator and returns -the first true result or the first error. Read more
Searches for an element in an iterator, returning its index. Read more
Returns the element that gives the maximum value from the -specified function. Read more
Returns the element that gives the maximum value with respect to the -specified comparison function. Read more
Returns the element that gives the minimum value from the -specified function. Read more
Returns the element that gives the minimum value with respect to the -specified comparison function. Read more
Converts an iterator of pairs into a pair of containers. Read more
Creates an iterator which copies all of its elements. Read more
Creates an iterator which clones all of its elements. Read more
🔬This is a nightly-only experimental API. (iter_array_chunks)
Returns an iterator over N elements of the iterator at a time. Read more
Sums the elements of an iterator. Read more
Iterates over the entire iterator, multiplying all the elements Read more
🔬This is a nightly-only experimental API. (iter_order_by)
Lexicographically compares the elements of this Iterator with those -of another with respect to the specified comparison function. Read more
Lexicographically compares the elements of this Iterator with those -of another. Read more
🔬This is a nightly-only experimental API. (iter_order_by)
Lexicographically compares the elements of this Iterator with those -of another with respect to the specified comparison function. Read more
Determines if the elements of this Iterator are equal to those of -another. Read more
🔬This is a nightly-only experimental API. (iter_order_by)
Determines if the elements of this Iterator are equal to those of -another with respect to the specified equality function. Read more
Determines if the elements of this Iterator are unequal to those of -another. Read more
Determines if the elements of this Iterator are lexicographically -less than those of another. Read more
Determines if the elements of this Iterator are lexicographically -less or equal to those of another. Read more
Determines if the elements of this Iterator are lexicographically -greater than those of another. Read more
Determines if the elements of this Iterator are lexicographically -greater than or equal to those of another. Read more
🔬This is a nightly-only experimental API. (is_sorted)
Checks if the elements of this iterator are sorted using the given comparator function. Read more
🔬This is a nightly-only experimental API. (is_sorted)
Checks if the elements of this iterator are sorted using the given key extraction -function. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

-

Calls U::from(self).

-

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-
The type of the elements being iterated over.
Which kind of iterator are we turning this into?
Creates an iterator from a value. Read more
Choose one element at random from the iterator. Read more
Choose one element at random from the iterator. Read more
Collects values at random from the iterator into a supplied buffer -until that buffer is filled. Read more
Collects amount values at random from the iterator into a vector. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/seq/trait.IteratorRandom.html b/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/seq/trait.IteratorRandom.html deleted file mode 100644 index bc64a98..0000000 --- a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/seq/trait.IteratorRandom.html +++ /dev/null @@ -1,69 +0,0 @@ -IteratorRandom in rand::seq - Rust
pub trait IteratorRandom: Iterator + Sized {
-    fn choose<R>(self, rng: &mut R) -> Option<Self::Item>
    where
        R: Rng + ?Sized
, - { ... } - fn choose_stable<R>(self, rng: &mut R) -> Option<Self::Item>
    where
        R: Rng + ?Sized
, - { ... } - fn choose_multiple_fill<R>(self, rng: &mut R, buf: &mut [Self::Item]) -> usize
    where
        R: Rng + ?Sized
, - { ... } - fn choose_multiple<R>(self, rng: &mut R, amount: usize) -> Vec<Self::Item>
    where
        R: Rng + ?Sized
, - { ... } -}
Expand description

Extension trait on iterators, providing random sampling methods.

-

This trait is implemented on all iterators I where I: Iterator + Sized -and provides methods for -choosing one or more elements. You must use this trait:

- -
use rand::seq::IteratorRandom;
-
-let mut rng = rand::thread_rng();
-
-let faces = "😀😎😐😕😠😢";
-println!("I am {}!", faces.chars().choose(&mut rng).unwrap());
-

Example output (non-deterministic):

-
I am 😀!
-

Provided Methods

Choose one element at random from the iterator.

-

Returns None if and only if the iterator is empty.

-

This method uses Iterator::size_hint for optimisation. With an -accurate hint and where Iterator::nth is a constant-time operation -this method can offer O(1) performance. Where no size hint is -available, complexity is O(n) where n is the iterator length. -Partial hints (where lower > 0) also improve performance.

-

Note that the output values and the number of RNG samples used -depends on size hints. In particular, Iterator combinators that don’t -change the values yielded but change the size hints may result in -choose returning different elements. If you want consistent results -and RNG usage consider using IteratorRandom::choose_stable.

-

Choose one element at random from the iterator.

-

Returns None if and only if the iterator is empty.

-

This method is very similar to choose except that the result -only depends on the length of the iterator and the values produced by -rng. Notably for any iterator of a given length this will make the -same requests to rng and if the same sequence of values are produced -the same index will be selected from self. This may be useful if you -need consistent results no matter what type of iterator you are working -with. If you do not need this stability prefer choose.

-

Note that this method still uses Iterator::size_hint to skip -constructing elements where possible, however the selection and rng -calls are the same in the face of this optimization. If you want to -force every element to be created regardless call .inspect(|e| ()).

-

Collects values at random from the iterator into a supplied buffer -until that buffer is filled.

-

Although the elements are selected randomly, the order of elements in -the buffer is neither stable nor fully random. If random ordering is -desired, shuffle the result.

-

Returns the number of elements added to the buffer. This equals the length -of the buffer unless the iterator contains insufficient elements, in which -case this equals the number of elements available.

-

Complexity is O(n) where n is the length of the iterator. -For slices, prefer SliceRandom::choose_multiple.

-

Collects amount values at random from the iterator into a vector.

-

This is equivalent to choose_multiple_fill except for the result type.

-

Although the elements are selected randomly, the order of elements in -the buffer is neither stable nor fully random. If random ordering is -desired, shuffle the result.

-

The length of the returned vector equals amount unless the iterator -contains insufficient elements, in which case it equals the number of -elements available.

-

Complexity is O(n) where n is the length of the iterator. -For slices, prefer SliceRandom::choose_multiple.

-

Implementors

\ No newline at end of file diff --git a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/seq/trait.SliceRandom.html b/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/seq/trait.SliceRandom.html deleted file mode 100644 index aeed0b0..0000000 --- a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/seq/trait.SliceRandom.html +++ /dev/null @@ -1,127 +0,0 @@ -SliceRandom in rand::seq - Rust
pub trait SliceRandom {
-    type Item;
-
-    fn choose<R>(&self, rng: &mut R) -> Option<&Self::Item>
    where
        R: Rng + ?Sized
; - fn choose_mut<R>(&mut self, rng: &mut R) -> Option<&mut Self::Item>
    where
        R: Rng + ?Sized
; - fn choose_multiple<R>(
        &self,
        rng: &mut R,
        amount: usize
    ) -> SliceChooseIter<'_, Self, Self::Item>Notable traits for SliceChooseIter<'a, S, T>impl<'a, S: Index<usize, Output = T> + ?Sized + 'a, T: 'a> Iterator for SliceChooseIter<'a, S, T> type Item = &'a T;
    where
        R: Rng + ?Sized
; - fn choose_weighted<R, F, B, X>(
        &self,
        rng: &mut R,
        weight: F
    ) -> Result<&Self::Item, WeightedError>
    where
        R: Rng + ?Sized,
        F: Fn(&Self::Item) -> B,
        B: SampleBorrow<X>,
        X: SampleUniform + for<'a> AddAssign<&'a X> + PartialOrd<X> + Clone + Default
; - fn choose_weighted_mut<R, F, B, X>(
        &mut self,
        rng: &mut R,
        weight: F
    ) -> Result<&mut Self::Item, WeightedError>
    where
        R: Rng + ?Sized,
        F: Fn(&Self::Item) -> B,
        B: SampleBorrow<X>,
        X: SampleUniform + for<'a> AddAssign<&'a X> + PartialOrd<X> + Clone + Default
; - fn choose_multiple_weighted<R, F, X>(
        &self,
        rng: &mut R,
        amount: usize,
        weight: F
    ) -> Result<SliceChooseIter<'_, Self, Self::Item>, WeightedError>
    where
        R: Rng + ?Sized,
        F: Fn(&Self::Item) -> X,
        X: Into<f64>
; - fn shuffle<R>(&mut self, rng: &mut R)
    where
        R: Rng + ?Sized
; - fn partial_shuffle<R>(
        &mut self,
        rng: &mut R,
        amount: usize
    ) -> (&mut [Self::Item], &mut [Self::Item])
    where
        R: Rng + ?Sized
; -}
Expand description

Extension trait on slices, providing random mutation and sampling methods.

-

This trait is implemented on all [T] slice types, providing several -methods for choosing and shuffling elements. You must use this trait:

- -
use rand::seq::SliceRandom;
-
-let mut rng = rand::thread_rng();
-let mut bytes = "Hello, random!".to_string().into_bytes();
-bytes.shuffle(&mut rng);
-let str = String::from_utf8(bytes).unwrap();
-println!("{}", str);
-

Example output (non-deterministic):

-
l,nmroHado !le
-

Required Associated Types

The element type.

-

Required Methods

Returns a reference to one random element of the slice, or None if the -slice is empty.

-

For slices, complexity is O(1).

-
Example
-
use rand::thread_rng;
-use rand::seq::SliceRandom;
-
-let choices = [1, 2, 4, 8, 16, 32];
-let mut rng = thread_rng();
-println!("{:?}", choices.choose(&mut rng));
-assert_eq!(choices[..0].choose(&mut rng), None);
-

Returns a mutable reference to one random element of the slice, or -None if the slice is empty.

-

For slices, complexity is O(1).

-

Chooses amount elements from the slice at random, without repetition, -and in random order. The returned iterator is appropriate both for -collection into a Vec and filling an existing buffer (see example).

-

In case this API is not sufficiently flexible, use index::sample.

-

For slices, complexity is the same as index::sample.

-
Example
-
use rand::seq::SliceRandom;
-
-let mut rng = &mut rand::thread_rng();
-let sample = "Hello, audience!".as_bytes();
-
-// collect the results into a vector:
-let v: Vec<u8> = sample.choose_multiple(&mut rng, 3).cloned().collect();
-
-// store in a buffer:
-let mut buf = [0u8; 5];
-for (b, slot) in sample.choose_multiple(&mut rng, buf.len()).zip(buf.iter_mut()) {
-    *slot = *b;
-}
-

Similar to choose, but where the likelihood of each outcome may be -specified.

-

The specified function weight maps each item x to a relative -likelihood weight(x). The probability of each item being selected is -therefore weight(x) / s, where s is the sum of all weight(x).

-

For slices of length n, complexity is O(n). -See also choose_weighted_mut, distributions::weighted.

-
Example
-
use rand::prelude::*;
-
-let choices = [('a', 2), ('b', 1), ('c', 1)];
-let mut rng = thread_rng();
-// 50% chance to print 'a', 25% chance to print 'b', 25% chance to print 'c'
-println!("{:?}", choices.choose_weighted(&mut rng, |item| item.1).unwrap().0);
-

Similar to choose_mut, but where the likelihood of each outcome may -be specified.

-

The specified function weight maps each item x to a relative -likelihood weight(x). The probability of each item being selected is -therefore weight(x) / s, where s is the sum of all weight(x).

-

For slices of length n, complexity is O(n). -See also choose_weighted, distributions::weighted.

-

Similar to choose_multiple, but where the likelihood of each element’s -inclusion in the output may be specified. The elements are returned in an -arbitrary, unspecified order.

-

The specified function weight maps each item x to a relative -likelihood weight(x). The probability of each item being selected is -therefore weight(x) / s, where s is the sum of all weight(x).

-

If all of the weights are equal, even if they are all zero, each element has -an equal likelihood of being selected.

-

The complexity of this method depends on the feature partition_at_index. -If the feature is enabled, then for slices of length n, the complexity -is O(n) space and O(n) time. Otherwise, the complexity is O(n) space and -O(n * log amount) time.

-
Example
-
use rand::prelude::*;
-
-let choices = [('a', 2), ('b', 1), ('c', 1)];
-let mut rng = thread_rng();
-// First Draw * Second Draw = total odds
-// -----------------------
-// (50% * 50%) + (25% * 67%) = 41.7% chance that the output is `['a', 'b']` in some order.
-// (50% * 50%) + (25% * 67%) = 41.7% chance that the output is `['a', 'c']` in some order.
-// (25% * 33%) + (25% * 33%) = 16.6% chance that the output is `['b', 'c']` in some order.
-println!("{:?}", choices.choose_multiple_weighted(&mut rng, 2, |item| item.1).unwrap().collect::<Vec<_>>());
-

Shuffle a mutable slice in place.

-

For slices of length n, complexity is O(n).

-
Example
-
use rand::seq::SliceRandom;
-use rand::thread_rng;
-
-let mut rng = thread_rng();
-let mut y = [1, 2, 3, 4, 5];
-println!("Unshuffled: {:?}", y);
-y.shuffle(&mut rng);
-println!("Shuffled:   {:?}", y);
-

Shuffle a slice in place, but exit early.

-

Returns two mutable slices from the source slice. The first contains -amount elements randomly permuted. The second has the remaining -elements that are not fully shuffled.

-

This is an efficient method to select amount elements at random from -the slice, provided the slice may be mutated.

-

If you only need to choose elements randomly and amount > self.len()/2 -then you may improve performance by taking -amount = values.len() - amount and using only the second slice.

-

If amount is greater than the number of elements in the slice, this -will perform a full shuffle.

-

For slices, complexity is O(m) where m = amount.

-

Implementations on Foreign Types

Implementors

\ No newline at end of file diff --git a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/sidebar-items.js b/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/sidebar-items.js deleted file mode 100644 index 8d7edd3..0000000 --- a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/sidebar-items.js +++ /dev/null @@ -1 +0,0 @@ -window.SIDEBAR_ITEMS = {"fn":[["random","Generates a random value using the thread-local random number generator."],["thread_rng","Retrieve the lazily-initialized thread-local random number generator, seeded by the system. Intended to be used in method chaining style, e.g. `thread_rng().gen::()`, or cached locally, e.g. `let mut rng = thread_rng();`. Invoked by the `Default` trait, making `ThreadRng::default()` equivalent."]],"mod":[["distributions","Generating random samples from probability distributions"],["prelude","Convenience re-export of common members"],["rngs","Random number generators and adapters"],["seq","Sequence-related functionality"]],"struct":[["Error","Error type of random number generators"]],"trait":[["CryptoRng","A marker trait used to indicate that an [`RngCore`] or `BlockRngCore` implementation is supposed to be cryptographically secure."],["Fill","Types which may be filled with random data"],["Rng","An automatically-implemented extension trait on [`RngCore`] providing high-level generic methods for sampling values and other convenience methods."],["RngCore","The core of a random number generator."],["SeedableRng","A random number generator that can be explicitly seeded."]]}; \ No newline at end of file diff --git a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/struct.Error.html b/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/struct.Error.html deleted file mode 100644 index c48875a..0000000 --- a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/struct.Error.html +++ /dev/null @@ -1,37 +0,0 @@ -Error in rand - Rust
pub struct Error { /* private fields */ }
Expand description

Error type of random number generators

-

In order to be compatible with std and no_std, this type has two -possible implementations: with std a boxed Error trait object is stored, -while with no_std we merely store an error code.

-

Implementations

Codes at or above this point can be used by users to define their own -custom errors.

-

This has a fixed value of (1 << 31) + (1 << 30) = 0xC000_0000, -therefore the number of values available for custom codes is 1 << 30.

-

This is identical to getrandom::Error::CUSTOM_START.

-

Codes below this point represent OS Errors (i.e. positive i32 values). -Codes at or above this point, but below Error::CUSTOM_START are -reserved for use by the rand and getrandom crates.

-

This is identical to getrandom::Error::INTERNAL_START.

-

Construct from any type supporting std::error::Error

-

Available only when configured with std.

-

See also From<NonZeroU32>, which is available with and without std.

-

Reference the inner error (std only)

-

When configured with std, this is a trivial operation and never -panics. Without std, this method is simply unavailable.

-

Unwrap the inner error (std only)

-

When configured with std, this is a trivial operation and never -panics. Without std, this method is simply unavailable.

-

Extract the raw OS error code (if this error came from the OS)

-

This method is identical to std::io::Error::raw_os_error(), except -that it works in no_std contexts. If this method returns None, the -error value can still be formatted via the Display implementation.

-

Retrieve the error code, if any.

-

If this Error was constructed via From<NonZeroU32>, then this method -will return this NonZeroU32 code (for no_std this is always the -case). Otherwise, this method will return None.

-

Trait Implementations

Formats the value using the given formatter. Read more
Formats the value using the given formatter. Read more
The lower-level source of this error, if any. Read more
👎Deprecated since 1.42.0: use the Display impl or to_string()
👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type based access to context intended for error reports. Read more
Converts to this type from the input type.
Converts to this type from the input type.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

-

Calls U::from(self).

-

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-
🔬This is a nightly-only experimental API. (provide_any)
Data providers should implement this method to provide all values they are able to -provide by using demand. Read more
Converts the given value to a String. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/trait.CryptoRng.html b/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/trait.CryptoRng.html deleted file mode 100644 index 6a8ac45..0000000 --- a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/trait.CryptoRng.html +++ /dev/null @@ -1,18 +0,0 @@ -CryptoRng in rand - Rust
pub trait CryptoRng { }
Expand description

A marker trait used to indicate that an RngCore or BlockRngCore -implementation is supposed to be cryptographically secure.

-

Cryptographically secure generators, also known as CSPRNGs, should -satisfy an additional properties over other generators: given the first -k bits of an algorithm’s output -sequence, it should not be possible using polynomial-time algorithms to -predict the next bit with probability significantly greater than 50%.

-

Some generators may satisfy an additional property, however this is not -required by this trait: if the CSPRNG’s state is revealed, it should not be -computationally-feasible to reconstruct output prior to this. Some other -generators allow backwards-computation and are considered reversible.

-

Note that this trait is provided for guidance only and cannot guarantee -suitability for cryptographic applications. In general it should only be -implemented for well-reviewed code implementing well-regarded algorithms.

-

Note also that use of a CryptoRng does not protect against other -weaknesses such as seeding from a weak entropy source or leaking state.

-

Implementations on Foreign Types

Implementors

\ No newline at end of file diff --git a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/trait.Fill.html b/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/trait.Fill.html deleted file mode 100644 index 240ce68..0000000 --- a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/trait.Fill.html +++ /dev/null @@ -1,10 +0,0 @@ -Fill in rand - Rust
pub trait Fill {
-    fn try_fill<R: Rng + ?Sized>(&mut self, rng: &mut R) -> Result<(), Error>;
-}
Expand description

Types which may be filled with random data

-

This trait allows arrays to be efficiently filled with random data.

-

Implementations are expected to be portable across machines unless -clearly documented otherwise (see the -Chapter on Portability).

-

Required Methods

Fill self with random data

-

Implementations on Foreign Types

Implementors

\ No newline at end of file diff --git a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/trait.Rng.html b/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/trait.Rng.html deleted file mode 100644 index a4478aa..0000000 --- a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/trait.Rng.html +++ /dev/null @@ -1,173 +0,0 @@ -Rng in rand - Rust

Trait rand::Rng

source · []
pub trait Rng: RngCore {
-    fn gen<T>(&mut self) -> T
    where
        Standard: Distribution<T>
, - { ... } - fn gen_range<T, R>(&mut self, range: R) -> T
    where
        T: SampleUniform,
        R: SampleRange<T>
, - { ... } - fn sample<T, D: Distribution<T>>(&mut self, distr: D) -> T { ... } - fn sample_iter<T, D>(self, distr: D) -> DistIter<D, Self, T>Notable traits for DistIter<D, R, T>impl<D, R, T> Iterator for DistIter<D, R, T>where
    D: Distribution<T>,
    R: Rng,
type Item = T;

    where
        D: Distribution<T>,
        Self: Sized
, - { ... } - fn fill<T: Fill + ?Sized>(&mut self, dest: &mut T) { ... } - fn try_fill<T: Fill + ?Sized>(&mut self, dest: &mut T) -> Result<(), Error> { ... } - fn gen_bool(&mut self, p: f64) -> bool { ... } - fn gen_ratio(&mut self, numerator: u32, denominator: u32) -> bool { ... } -}
Expand description

An automatically-implemented extension trait on RngCore providing high-level -generic methods for sampling values and other convenience methods.

-

This is the primary trait to use when generating random values.

-

Generic usage

-

The basic pattern is fn foo<R: Rng + ?Sized>(rng: &mut R). Some -things are worth noting here:

-
    -
  • Since Rng: RngCore and every RngCore implements Rng, it makes no -difference whether we use R: Rng or R: RngCore.
  • -
  • The + ?Sized un-bounding allows functions to be called directly on -type-erased references; i.e. foo(r) where r: &mut dyn RngCore. Without -this it would be necessary to write foo(&mut r).
  • -
-

An alternative pattern is possible: fn foo<R: Rng>(rng: R). This has some -trade-offs. It allows the argument to be consumed directly without a &mut -(which is how from_rng(thread_rng()) works); also it still works directly -on references (including type-erased references). Unfortunately within the -function foo it is not known whether rng is a reference type or not, -hence many uses of rng require an extra reference, either explicitly -(distr.sample(&mut rng)) or implicitly (rng.gen()); one may hope the -optimiser can remove redundant references later.

-

Example:

- -
use rand::Rng;
-
-fn foo<R: Rng + ?Sized>(rng: &mut R) -> f32 {
-    rng.gen()
-}
-
-

Provided Methods

Return a random value supporting the Standard distribution.

-
Example
-
use rand::{thread_rng, Rng};
-
-let mut rng = thread_rng();
-let x: u32 = rng.gen();
-println!("{}", x);
-println!("{:?}", rng.gen::<(f64, bool)>());
-
Arrays and tuples
-

The rng.gen() method is able to generate arrays (up to 32 elements) -and tuples (up to 12 elements), so long as all element types can be -generated. -When using rustc ≥ 1.51, enable the min_const_gen feature to support -arrays larger than 32 elements.

-

For arrays of integers, especially for those with small element types -(< 64 bit), it will likely be faster to instead use Rng::fill.

- -
use rand::{thread_rng, Rng};
-
-let mut rng = thread_rng();
-let tuple: (u8, i32, char) = rng.gen(); // arbitrary tuple support
-
-let arr1: [f32; 32] = rng.gen();        // array construction
-let mut arr2 = [0u8; 128];
-rng.fill(&mut arr2);                    // array fill
-

Generate a random value in the given range.

-

This function is optimised for the case that only a single sample is -made from the given range. See also the Uniform distribution -type which may be faster if sampling from the same range repeatedly.

-

Only gen_range(low..high) and gen_range(low..=high) are supported.

-
Panics
-

Panics if the range is empty.

-
Example
-
use rand::{thread_rng, Rng};
-
-let mut rng = thread_rng();
-
-// Exclusive range
-let n: u32 = rng.gen_range(0..10);
-println!("{}", n);
-let m: f64 = rng.gen_range(-40.0..1.3e5);
-println!("{}", m);
-
-// Inclusive range
-let n: u32 = rng.gen_range(0..=10);
-println!("{}", n);
-

Sample a new value, using the given distribution.

-
Example
-
use rand::{thread_rng, Rng};
-use rand::distributions::Uniform;
-
-let mut rng = thread_rng();
-let x = rng.sample(Uniform::new(10u32, 15));
-// Type annotation requires two types, the type and distribution; the
-// distribution can be inferred.
-let y = rng.sample::<u16, _>(Uniform::new(10, 15));
-

Create an iterator that generates values using the given distribution.

-

Note that this function takes its arguments by value. This works since -(&mut R): Rng where R: Rng and -(&D): Distribution where D: Distribution, -however borrowing is not automatic hence rng.sample_iter(...) may -need to be replaced with (&mut rng).sample_iter(...).

-
Example
-
use rand::{thread_rng, Rng};
-use rand::distributions::{Alphanumeric, Uniform, Standard};
-
-let mut rng = thread_rng();
-
-// Vec of 16 x f32:
-let v: Vec<f32> = (&mut rng).sample_iter(Standard).take(16).collect();
-
-// String:
-let s: String = (&mut rng).sample_iter(Alphanumeric)
-    .take(7)
-    .map(char::from)
-    .collect();
-
-// Combined values
-println!("{:?}", (&mut rng).sample_iter(Standard).take(5)
-                             .collect::<Vec<(f64, bool)>>());
-
-// Dice-rolling:
-let die_range = Uniform::new_inclusive(1, 6);
-let mut roll_die = (&mut rng).sample_iter(die_range);
-while roll_die.next().unwrap() != 6 {
-    println!("Not a 6; rolling again!");
-}
-

Fill any type implementing Fill with random data

-

The distribution is expected to be uniform with portable results, but -this cannot be guaranteed for third-party implementations.

-

This is identical to try_fill except that it panics on error.

-
Example
-
use rand::{thread_rng, Rng};
-
-let mut arr = [0i8; 20];
-thread_rng().fill(&mut arr[..]);
-

Fill any type implementing Fill with random data

-

The distribution is expected to be uniform with portable results, but -this cannot be guaranteed for third-party implementations.

-

This is identical to fill except that it forwards errors.

-
Example
-
use rand::{thread_rng, Rng};
-
-let mut arr = [0u64; 4];
-thread_rng().try_fill(&mut arr[..])?;
-
-

Return a bool with a probability p of being true.

-

See also the Bernoulli distribution, which may be faster if -sampling from the same probability repeatedly.

-
Example
-
use rand::{thread_rng, Rng};
-
-let mut rng = thread_rng();
-println!("{}", rng.gen_bool(1.0 / 3.0));
-
Panics
-

If p < 0 or p > 1.

-

Return a bool with a probability of numerator/denominator of being -true. I.e. gen_ratio(2, 3) has chance of 2 in 3, or about 67%, of -returning true. If numerator == denominator, then the returned value -is guaranteed to be true. If numerator == 0, then the returned -value is guaranteed to be false.

-

See also the Bernoulli distribution, which may be faster if -sampling from the same numerator and denominator repeatedly.

-
Panics
-

If denominator == 0 or numerator > denominator.

-
Example
-
use rand::{thread_rng, Rng};
-
-let mut rng = thread_rng();
-println!("{}", rng.gen_ratio(2, 3));
-

Implementors

\ No newline at end of file diff --git a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/trait.RngCore.html b/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/trait.RngCore.html deleted file mode 100644 index 0fca8b9..0000000 --- a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/trait.RngCore.html +++ /dev/null @@ -1,105 +0,0 @@ -RngCore in rand - Rust
pub trait RngCore {
-    fn next_u32(&mut self) -> u32;
-    fn next_u64(&mut self) -> u64;
-    fn fill_bytes(&mut self, dest: &mut [u8]);
-    fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error>;
-}
Expand description

The core of a random number generator.

-

This trait encapsulates the low-level functionality common to all -generators, and is the “back end”, to be implemented by generators. -End users should normally use the Rng trait from the rand crate, -which is automatically implemented for every type implementing RngCore.

-

Three different methods for generating random data are provided since the -optimal implementation of each is dependent on the type of generator. There -is no required relationship between the output of each; e.g. many -implementations of fill_bytes consume a whole number of u32 or u64 -values and drop any remaining unused bytes. The same can happen with the -next_u32 and next_u64 methods, implementations may discard some -random bits for efficiency.

-

The try_fill_bytes method is a variant of fill_bytes allowing error -handling; it is not deemed sufficiently useful to add equivalents for -next_u32 or next_u64 since the latter methods are almost always used -with algorithmic generators (PRNGs), which are normally infallible.

-

Implementers should produce bits uniformly. Pathological RNGs (e.g. always -returning the same value, or never setting certain bits) can break rejection -sampling used by random distributions, and also break other RNGs when -seeding them via SeedableRng::from_rng.

-

Algorithmic generators implementing SeedableRng should normally have -portable, reproducible output, i.e. fix Endianness when converting values -to avoid platform differences, and avoid making any changes which affect -output (except by communicating that the release has breaking changes).

-

Typically an RNG will implement only one of the methods available -in this trait directly, then use the helper functions from the -impls module to implement the other methods.

-

It is recommended that implementations also implement:

-
    -
  • Debug with a custom implementation which does not print any internal -state (at least, CryptoRngs should not risk leaking state through -Debug).
  • -
  • Serialize and Deserialize (from Serde), preferably making Serde -support optional at the crate level in PRNG libs.
  • -
  • Clone, if possible.
  • -
  • never implement Copy (accidental copies may cause repeated values).
  • -
  • do not implement Default for pseudorandom generators, but instead -implement SeedableRng, to guide users towards proper seeding. -External / hardware RNGs can choose to implement Default.
  • -
  • Eq and PartialEq could be implemented, but are probably not useful.
  • -
-

Example

-

A simple example, obviously not generating very random output:

- -
#![allow(dead_code)]
-use rand_core::{RngCore, Error, impls};
-
-struct CountingRng(u64);
-
-impl RngCore for CountingRng {
-    fn next_u32(&mut self) -> u32 {
-        self.next_u64() as u32
-    }
-
-    fn next_u64(&mut self) -> u64 {
-        self.0 += 1;
-        self.0
-    }
-
-    fn fill_bytes(&mut self, dest: &mut [u8]) {
-        impls::fill_bytes_via_next(self, dest)
-    }
-
-    fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error> {
-        Ok(self.fill_bytes(dest))
-    }
-}
-

Required Methods

Return the next random u32.

-

RNGs must implement at least one method from this trait directly. In -the case this method is not implemented directly, it can be implemented -using self.next_u64() as u32 or via impls::next_u32_via_fill.

-

Return the next random u64.

-

RNGs must implement at least one method from this trait directly. In -the case this method is not implemented directly, it can be implemented -via impls::next_u64_via_u32 or via impls::next_u64_via_fill.

-

Fill dest with random data.

-

RNGs must implement at least one method from this trait directly. In -the case this method is not implemented directly, it can be implemented -via impls::fill_bytes_via_next or -via RngCore::try_fill_bytes; if this generator can -fail the implementation must choose how best to handle errors here -(e.g. panic with a descriptive message or log a warning and retry a few -times).

-

This method should guarantee that dest is entirely filled -with new data, and may panic if this is impossible -(e.g. reading past the end of a file that is being used as the -source of randomness).

-

Fill dest entirely with random data.

-

This is the only method which allows an RNG to report errors while -generating random data thus making this the primary method implemented -by external (true) RNGs (e.g. OsRng) which can fail. It may be used -directly to generate keys and to seed (infallible) PRNGs.

-

Other than error handling, this method is identical to RngCore::fill_bytes; -thus this may be implemented using Ok(self.fill_bytes(dest)) or -fill_bytes may be implemented with -self.try_fill_bytes(dest).unwrap() or more specific error handling.

-

Trait Implementations

Pull some bytes from this source into the specified buffer, returning -how many bytes were read. Read more
Like read, except that it reads into a slice of buffers. Read more
🔬This is a nightly-only experimental API. (can_vector)
Determines if this Reader has an efficient read_vectored -implementation. Read more
Read all bytes until EOF in this source, placing them into buf. Read more
Read all bytes until EOF in this source, appending them to buf. Read more
Read the exact number of bytes required to fill buf. Read more
🔬This is a nightly-only experimental API. (read_buf)
Pull some bytes from this source into the specified buffer. Read more
🔬This is a nightly-only experimental API. (read_buf)
Read the exact number of bytes required to fill cursor. Read more

Implementations on Foreign Types

Implementors

\ No newline at end of file diff --git a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/trait.SeedableRng.html b/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/trait.SeedableRng.html deleted file mode 100644 index 2bc7600..0000000 --- a/rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/trait.SeedableRng.html +++ /dev/null @@ -1,110 +0,0 @@ -SeedableRng in rand - Rust
pub trait SeedableRng: Sized {
-    type Seed: Sized + Default + AsMut<[u8]>;
-
-    fn from_seed(seed: Self::Seed) -> Self;
-
-    fn seed_from_u64(state: u64) -> Self { ... }
-    fn from_rng<R>(rng: R) -> Result<Self, Error>
    where
        R: RngCore
, - { ... } - fn from_entropy() -> Self { ... } -}
Expand description

A random number generator that can be explicitly seeded.

-

This trait encapsulates the low-level functionality common to all -pseudo-random number generators (PRNGs, or algorithmic generators).

-

Required Associated Types

Seed type, which is restricted to types mutably-dereferenceable as u8 -arrays (we recommend [u8; N] for some N).

-

It is recommended to seed PRNGs with a seed of at least circa 100 bits, -which means an array of [u8; 12] or greater to avoid picking RNGs with -partially overlapping periods.

-

For cryptographic RNG’s a seed of 256 bits is recommended, [u8; 32].

-
Implementing SeedableRng for RNGs with large seeds
-

Note that the required traits core::default::Default and -core::convert::AsMut<u8> are not implemented for large arrays -[u8; N] with N > 32. To be able to implement the traits required by -SeedableRng for RNGs with such large seeds, the newtype pattern can be -used:

- -
use rand_core::SeedableRng;
-
-const N: usize = 64;
-pub struct MyRngSeed(pub [u8; N]);
-pub struct MyRng(MyRngSeed);
-
-impl Default for MyRngSeed {
-    fn default() -> MyRngSeed {
-        MyRngSeed([0; N])
-    }
-}
-
-impl AsMut<[u8]> for MyRngSeed {
-    fn as_mut(&mut self) -> &mut [u8] {
-        &mut self.0
-    }
-}
-
-impl SeedableRng for MyRng {
-    type Seed = MyRngSeed;
-
-    fn from_seed(seed: MyRngSeed) -> MyRng {
-        MyRng(seed)
-    }
-}
-

Required Methods

Create a new PRNG using the given seed.

-

PRNG implementations are allowed to assume that bits in the seed are -well distributed. That means usually that the number of one and zero -bits are roughly equal, and values like 0, 1 and (size - 1) are unlikely. -Note that many non-cryptographic PRNGs will show poor quality output -if this is not adhered to. If you wish to seed from simple numbers, use -seed_from_u64 instead.

-

All PRNG implementations should be reproducible unless otherwise noted: -given a fixed seed, the same sequence of output should be produced -on all runs, library versions and architectures (e.g. check endianness). -Any “value-breaking” changes to the generator should require bumping at -least the minor version and documentation of the change.

-

It is not required that this function yield the same state as a -reference implementation of the PRNG given equivalent seed; if necessary -another constructor replicating behaviour from a reference -implementation can be added.

-

PRNG implementations should make sure from_seed never panics. In the -case that some special values (like an all zero seed) are not viable -seeds it is preferable to map these to alternative constant value(s), -for example 0xBAD5EEDu32 or 0x0DDB1A5E5BAD5EEDu64 (“odd biases? bad -seed”). This is assuming only a small number of values must be rejected.

-

Provided Methods

Create a new PRNG using a u64 seed.

-

This is a convenience-wrapper around from_seed to allow construction -of any SeedableRng from a simple u64 value. It is designed such that -low Hamming Weight numbers like 0 and 1 can be used and should still -result in good, independent seeds to the PRNG which is returned.

-

This is not suitable for cryptography, as should be clear given that -the input size is only 64 bits.

-

Implementations for PRNGs may provide their own implementations of -this function, but the default implementation should be good enough for -all purposes. Changing the implementation of this function should be -considered a value-breaking change.

-

Create a new PRNG seeded from another Rng.

-

This may be useful when needing to rapidly seed many PRNGs from a master -PRNG, and to allow forking of PRNGs. It may be considered deterministic.

-

The master PRNG should be at least as high quality as the child PRNGs. -When seeding non-cryptographic child PRNGs, we recommend using a -different algorithm for the master PRNG (ideally a CSPRNG) to avoid -correlations between the child PRNGs. If this is not possible (e.g. -forking using small non-crypto PRNGs) ensure that your PRNG has a good -mixing function on the output or consider use of a hash function with -from_seed.

-

Note that seeding XorShiftRng from another XorShiftRng provides an -extreme example of what can go wrong: the new PRNG will be a clone -of the parent.

-

PRNG implementations are allowed to assume that a good RNG is provided -for seeding, and that it is cryptographically secure when appropriate. -As of rand 0.7 / rand_core 0.5, implementations overriding this -method should ensure the implementation satisfies reproducibility -(in prior versions this was not required).

-

Creates a new instance of the RNG seeded via getrandom.

-

This method is the recommended way to construct non-deterministic PRNGs -since it is convenient and secure.

-

In case the overhead of using getrandom to seed many PRNGs is an -issue, one may prefer to seed from a local PRNG, e.g. -from_rng(thread_rng()).unwrap().

-
Panics
-

If getrandom is unable to provide secure entropy this method will panic.

-

Implementations on Foreign Types

Implementors

\ No newline at end of file -- cgit v1.2.3-70-g09d2