Skip to main content
Log in

Mojo function

randn

randn[type: DType](ptr: UnsafePointer[SIMD[type, 1]], size: Int, mean: SIMD[float64, 1] = __init__[__mlir_type.!pop.float_literal](0), standard_deviation: SIMD[float64, 1] = __init__[__mlir_type.!pop.float_literal](1))

Fills memory with random values from a Normal(mean, standard_deviation) distribution.

Constraints:

The type should be floating point.

Parameters:

  • type (DType): The dtype of the pointer.

Args:

  • ptr (UnsafePointer[SIMD[type, 1]]): The pointer to the memory area to fill.
  • size (Int): The number of elements to fill.
  • mean (SIMD[float64, 1]): Normal distribution mean.
  • standard_deviation (SIMD[float64, 1]): Normal distribution standard deviation.