Mojo function
rand
rand[type: DType](ptr: UnsafePointer[SIMD[type, 1], address_space=address_space, alignment=alignment, origin=origin], size: Int, /, *, min: SIMD[float64, 1] = SIMD(#kgen.float_literal<0|1>), max: SIMD[float64, 1] = SIMD(#kgen.float_literal<1|1>), int_scale: Optional[Int] = Optional(None))
Fills memory with random values from a uniform distribution.
Parameters:
- type (
DType
): The dtype of the pointer.
Args:
- ptr (
UnsafePointer[SIMD[type, 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. - min (
SIMD[float64, 1]
): The minimum value for random. - max (
SIMD[float64, 1]
): The maximum value for random. - int_scale (
Optional[Int]
): The scale for error checking (float type only).
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!