cunumeric.random.sample#

cunumeric.random.sample(size: NdShapeLike | None = None, dtype: npt.DTypeLike = <class 'numpy.float64'>) float | ndarray#

random_sample(size=None)

Return random floats in the half-open interval [0.0, 1.0).

Results are from the “continuous uniform” distribution over the stated interval. To sample \(Unif[a, b), b > a\) multiply the output of random_sample by (b-a) and add a:

(b - a) * random_sample() + a
Parameters:

size (int or tuple of ints, optional) – Output shape. If the given shape is, e.g., (m, n, k), then m * n * k samples are drawn. Default is None, in which case a single value is returned.

Returns:

out – Array of random floats of shape size (unless size=None, in which case a single float is returned).

Return type:

float or ndarray of floats

Availability:

Multiple GPUs, Multiple CPUs