pub struct Normal<N> { /* private fields */ }
Expand description
The normal distribution N(mean, std_dev**2)
.
This uses the ZIGNOR variant of the Ziggurat method, see StandardNormal
for more details.
Note that StandardNormal
is an optimised implementation for mean 0, and
standard deviation 1.
§Example
use rand_distr::{Normal, Distribution};
// mean 2, standard deviation 3
let normal = Normal::new(2.0, 3.0).unwrap();
let v = normal.sample(&mut rand::thread_rng());
println!("{} is from a N(2, 9) distribution", v)
Implementations§
Trait Implementations§
Source§impl<N: Float> Distribution<N> for Normal<N>where
StandardNormal: Distribution<N>,
impl<N: Float> Distribution<N> for Normal<N>where
StandardNormal: Distribution<N>,
impl<N: Copy> Copy for Normal<N>
Auto Trait Implementations§
impl<N> Freeze for Normal<N>where
N: Freeze,
impl<N> RefUnwindSafe for Normal<N>where
N: RefUnwindSafe,
impl<N> Send for Normal<N>where
N: Send,
impl<N> Sync for Normal<N>where
N: Sync,
impl<N> Unpin for Normal<N>where
N: Unpin,
impl<N> UnwindSafe for Normal<N>where
N: UnwindSafe,
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