You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<p>Generates random numbers with help of random-number
166
-
generator <ahref="https://docs.rs/rand/0.9/rand/trait.Rng.html"><code>rand::Rng</code></a> obtained via <ahref="https://docs.rs/rand/0.9/rand/trait.Rng.html"><code>rand::rng</code></a>. Each thread has an
167
-
initialized generator. Integers are uniformly distributed over the range of the
168
-
type, and floating point numbers are uniformly distributed from 0 up to but not
165
+
<p>Generates random numbers with help of random-number generator <ahref="https://docs.rs/rand/latest/rand/trait.Rng.html"><code>rand::Rng</code></a> obtained via
166
+
<ahref="https://docs.rs/rand/latest/rand/fn.rng.html"><code>rand::rng()</code></a>. Each thread has an initialized generator. Integers are uniformly distributed over the
167
+
range of the type, and floating point numbers are uniformly distributed from 0 up to but not
<h2id="generate-random-numbers-within-a-range"><aclass="header" href="#generate-random-numbers-within-a-range">Generate random numbers within a range</a></h2>
<p>Generates a random value within half-open <code>[0, 10)</code> range (not including <code>10</code>) with [<code>Rng::gen_range</code>].</p>
178
+
<p>Generates a random value within half-open <code>[0, 10)</code> range (not including <code>10</code>) with <ahref="https://docs.rs/rand/latest/rand/trait.Rng.html#method.random_range"><code>Rng::random_range</code></a>.</p>
<p><ahref="https://docs.rs/rand_distr/latest/rand_distr/struct.Uniform.html"><code>Uniform</code></a> can obtain values with <ahref="https://en.wikipedia.org/wiki/Uniform_distribution_(continuous)">uniform distribution</a>. This has the same effect, but may be
187
+
faster when repeatedly generating numbers in the same range.</p>
<h2id="generate-random-numbers-with-given-distribution"><aclass="header" href="#generate-random-numbers-with-given-distribution">Generate random numbers with given distribution</a></h2>
<p>By default, random numbers in the <code>rand</code> crate have
209
-
<ahref="https://en.wikipedia.org/wiki/Uniform_distribution_(continuous)">uniform distribution</a>. The <ahref="https://docs.rs/rand_distr/*/rand_distr/index.html"><code>rand_distr</code></a> crate provides
210
-
other kinds of distributions. To use them, you instantiate
211
-
a distribution, then sample from that distribution using
212
-
<ahref="https://docs.rs/rand/0.9/rand/distr/trait.Distribution.html#tymethod.sample"><code>Distribution::sample</code></a> with help of a random-number
use rand_distr::{Distribution, LogNormal, Normal};
205
+
<p>By default, random numbers in the <code>rand</code> crate have <ahref="https://en.wikipedia.org/wiki/Uniform_distribution_(continuous)">uniform distribution</a>. The <ahref="https://docs.rs/rand_distr/*/rand_distr/index.html"><code>rand_distr</code></a> crate
206
+
provides other kinds of distributions. To use them, you instantiate a distribution, then sample from
207
+
that distribution using <ahref="https://docs.rs/rand/0.9/rand/distr/trait.Distribution.html#tymethod.sample"><code>Distribution::sample</code></a> with help of a random-number generator
<h2id="generate-random-values-of-a-custom-type"><aclass="header" href="#generate-random-values-of-a-custom-type">Generate random values of a custom type</a></h2>
<p>Randomly generates a tuple <code>(i32, bool, f64)</code> and variable of user defined type <code>Point</code>. Implements
226
+
the <ahref="https://docs.rs/rand/latest/rand/distr/trait.Distribution.html"><code>Distribution</code></a> trait on type Point for <ahref="https://docs.rs/rand/latest/rand/distr/struct.Standard.html"><code>Standard</code></a> in order to allow random generation.</p>
<h2id="create-random-passwords-from-a-set-of-alphanumeric-characters"><aclass="header" href="#create-random-passwords-from-a-set-of-alphanumeric-characters">Create random passwords from a set of alphanumeric characters</a></h2>
<p>Randomly generates a string of given length ASCII characters in the range <code>A-Z, a-z, 0-9</code>, with <ahref="https://docs.rs/rand/0.9/rand/distr/struct.Alphanumeric.html"><code>Alphanumeric</code></a> sample.</p>
254
+
<p>Randomly generates a string of given length ASCII characters in the range <code>A-Z, a-z, 0-9</code>, with
<h2id="create-random-passwords-from-a-set-of-user-defined-characters"><aclass="header" href="#create-random-passwords-from-a-set-of-user-defined-characters">Create random passwords from a set of user-defined characters</a></h2>
0 commit comments