Skip to main content
Log in

Mojo function

randn

randn[dtype: DType](ptr: UnsafePointer[SIMD[dtype, 1], address_space=address_space, alignment=alignment, origin=origin], 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:

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

Args:

  • ptr (UnsafePointer[SIMD[dtype, 1], address_space=address_space, alignment=alignment, origin=origin]): 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.