Struct rand::distributions::StandardNormal[][src]

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);

  1. Jurgen A. Doornik (2005). An Improved Ziggurat Method to Generate Normal Random Samples. Nuffield College, Oxford 

Trait Implementations

impl Clone for StandardNormal

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Copy for StandardNormal

impl Debug for StandardNormal

Formats the value using the given formatter. Read more

impl Distribution<f64> for StandardNormal

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

Important traits for DistIter<'a, D, R, T>

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

Auto Trait Implementations