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: Float32, stddev: Float32, 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 (
Float32): The mean of the normal distribution. - stddev (
Float32): 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!