Skip to main content
Log in

Mojo function

randn

randn[type: DType](ptr: UnsafePointer[SIMD[type, 1]], size: Int, mean: SIMD[float64, 1] = SIMD(#kgen.float_literal<0|1>), variance: SIMD[float64, 1] = SIMD(#kgen.float_literal<1|1>))

Fills memory with random values from a Normal(mean, variance) 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.
  • variance (SIMD[float64, 1]): Normal distribution variance.