Skip to main content

normal

Function normal 

Source
pub fn normal<T: Float>(
    rng: &mut Rng,
    shape: Vec<usize>,
    mean: T,
    std_dev: T,
) -> Tensor<T>
Expand description

Create a tensor of samples from a Gaussian distribution.

Uses the Box-Muller transform internally.

§Examples

use scivex_core::random::{Rng, normal};
let mut rng = Rng::new(1);
let t = normal::<f64>(&mut rng, vec![3], 0.0_f64, 1.0_f64);
assert_eq!(t.shape(), &[3]);