Struct rand_distr::StandardNormal
source · pub struct StandardNormal;
Expand description
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.
Example
use rand::prelude::*;
use rand_distr::StandardNormal;
let val: f64 = thread_rng().sample(StandardNormal);
println!("{}", val);
Jurgen A. Doornik (2005). An Improved Ziggurat Method to Generate Normal Random Samples. Nuffield College, Oxford ↩
Trait Implementations§
source§impl Clone for StandardNormal
impl Clone for StandardNormal
source§fn clone(&self) -> StandardNormal
fn clone(&self) -> StandardNormal
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for StandardNormal
impl Debug for StandardNormal
source§impl Distribution<f32> for StandardNormal
impl Distribution<f32> for StandardNormal
source§impl Distribution<f64> for StandardNormal
impl Distribution<f64> for StandardNormal
impl Copy for StandardNormal
Auto Trait Implementations§
impl RefUnwindSafe for StandardNormal
impl Send for StandardNormal
impl Sync for StandardNormal
impl Unpin for StandardNormal
impl UnwindSafe for StandardNormal
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more