pub struct StandardNormal;
Expand description
The standard Normal distribution N(0, 1)
.
This is equivalent to Normal::new(0.0, 1.0)
, but faster.
See Normal
for the general Normal distribution.
§Plot
The following diagram shows the standard Normal distribution.
§Example
use rand::prelude::*;
use rand_distr::StandardNormal;
let val: f64 = rand::rng().sample(StandardNormal);
println!("{}", val);
§Notes
Implemented via the ZIGNOR variant1 of the Ziggurat method.
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<'de> Deserialize<'de> for StandardNormal
impl<'de> Deserialize<'de> for StandardNormal
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Distribution<f32> for StandardNormal
impl Distribution<f32> for StandardNormal
Source§impl Distribution<f64> for StandardNormal
impl Distribution<f64> for StandardNormal
Source§impl Serialize for StandardNormal
impl Serialize for StandardNormal
impl Copy for StandardNormal
Auto Trait Implementations§
impl Freeze for StandardNormal
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