pub struct StandardNormal;
Samples floating-point numbers according to the normal distribution
N(0, 1)
(a.k.a. a standard normal, or Gaussian). This is equivalent to
Normal::new(0.0, 1.0)
but faster.
See Normal
for the general normal distribution.
Implemented via the ZIGNOR variant1 of the Ziggurat method.
use rand::prelude::*;
use rand::distributions::StandardNormal;
let val: f64 = SmallRng::from_entropy().sample(StandardNormal);
println!("{}", val);
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.
Important traits for DistIter<'a, D, R, T>
impl<'a, D, R, T> Iterator for DistIter<'a, D, R, T> where
D: Distribution<T>,
R: Rng + 'a, type Item = T;
[−]
Create an iterator that generates random values of T
, using rng
as the source of randomness. Read more
Creates owned data from borrowed data, usually by cloning. Read more
🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
Immutably borrows from an owned value. Read more
[+]
[+]
type Error = <U as TryFrom<T>>::Error
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
[−]
🔬 This is a nightly-only experimental API. (try_from
)
[+]
[−]
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static