dpnp.random.RandomState.random_sample

method

RandomState.random_sample(size=None, usm_type='device')[source]

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

Results are from the “continuous uniform” distribution over the interval.

For full documentation refer to numpy.random.RandomState.random_sample.

Parameters:

usm_type ({"device", "shared", "host"}, optional) -- The type of SYCL USM allocation for the output array.

Returns:

out -- Array of random floats of shape size (if size=None, zero dimension array with a single float is returned). Output array data type is dpnp.float64 if device supports it, or dpnp.float32 otherwise.

Return type:

dpnp.ndarray

Examples

>>> s = dpnp.random.RandomState().random_sample(size=(4,))
>>> print(s)
[0.13436424 0.56920387 0.84743374 0.80226506]