pub fn random_normal<F: Float + Debug, R: Rng>(
shape: IxDyn,
mean: F,
std: F,
rng: &mut R,
) -> Result<Array<F, IxDyn>>
Expand description
Generate a random vector or matrix with values from a normal distribution
§Arguments
shape
- The shape of the array to generatemean
- The mean of the normal distributionstd
- The standard deviation of the normal distributionrng
- Random number generator
§Returns
- A random array with the specified shape and distribution
§Examples
use scirs2_neural::utils::random_normal;
use scirs2_core::ndarray::IxDyn;
use scirs2_core::random::rngs::SmallRng;
use scirs2_core::random::SeedableRng;
let mut rng = scirs2_core::random::rng();
let shape = IxDyn(&[2, 3]);
let random_matrix = random_normal(shape, 0.0, 1.0, &mut rng).unwrap();
assert_eq!(random_matrix.shape(), &[2, 3]);