dpnp.random.RandomState.rand

method

RandomState.rand(*args, usm_type='device')[source]

Draw random values in a given shape.

Create an array of the given shape and populate it with random samples from a uniform distribution over [0, 1).

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

Parameters:

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

Returns:

out -- Random values in a given shape. Output array data type is dpnp.float64 if device supports it, or dpnp.float32 otherwise.

Return type:

dpnp.ndarray

Examples

>>> s = dpnp.random.RandomState().rand(5, 2)
>>> print(s)
[[0.13436424 0.56920387]
 [0.84743374 0.80226506]
 [0.76377462 0.06310682]
 [0.25506903 0.1179187 ]
 [0.49543509 0.76096244]]