Mojo function
rand
rand[dtype: DType](ptr: UnsafePointer[Scalar[dtype], origin, address_space=address_space], size: Int, /, *, min: Float64 = 0, max: Float64 = 1, int_scale: Optional[Int] = None)
Fills memory with random values from a uniform distribution.
Parameters:
- dtype (
DType): The dtype of the pointer.
Args:
- ptr (
UnsafePointer): The pointer to the memory area to fill. - size (
Int): The number of elements to fill. - min (
Float64): The minimum value for random. - max (
Float64): The maximum value for random. - int_scale (
Optional): 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!