Mojo function
random_normal
random_normal[dtype: DType, rank: Int, //, output_fn: fn[width: Int, _rank: Int](idx: IndexList[_rank], val: SIMD[dtype, width]) capturing -> None, target: StringSlice[StaticConstantOrigin]](shape: IndexList[rank], mean: Scalar[dtype], stddev: Scalar[dtype], seed_value: UInt64, ctx: DeviceContextPtr)
Call output_fn with values generated from a normal distribution with the specified mean and standard deviation.
Parameters:
- dtype (DType): The data type to generate.
- rank (Int): The rank of the underlying buffer.
- output_fn (fn[width: Int, _rank: Int](idx: IndexList[_rank], val: SIMD[dtype, width]) capturing -> None): The function which stores the generated values.
- target (StringSlice): The target to run on.
Args:
- shape (IndexList): The shape of the output being stored into by output_fn.
- mean (Scalar): The mean of the normal distribution.
- stddev (Scalar): The standard deviation of the normal distribution.
- seed_value (UInt64): Seed value used to initialize the random number generator.
- ctx (DeviceContextPtr): The device context.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!
