Skip to main content

function

randn

randn[type: DType](ptr: DTypePointer[type, 0], size: Int, mean: SIMD[float64, 1] = #kgen.float_literal<0|1>, variance: SIMD[float64, 1] = #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 (DTypePointer[type, 0]): 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.