From b5aa889f7fced8ba2cc1698ae9696d7bd0ca8ab5 Mon Sep 17 00:00:00 2001 From: garhve Date: Tue, 20 Dec 2022 11:07:35 +0800 Subject: remove compiled binary --- .../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 -- 47 files changed, 1294 deletions(-) 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 (limited to 'rust/theBook/chapter-2-guessing-game/guessing_game/target/doc/rand/distributions') 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 -- cgit v1.2.3-70-g09d2