dpnp.random.rand
- dpnp.random.rand(*args, device=None, usm_type='device', sycl_queue=None)[source]
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.rand.- Parameters:
*args (sequence of ints, optional) -- The dimensions of the returned array, must be non-negative. If no argument is given a single Python float is returned.
device ({None, string, SyclDevice, SyclQueue, Device}, optional) --
An array API concept of device where the output array is created. device can be
None, a oneAPI filter selector string, an instance ofdpctl.SyclDevicecorresponding to a non-partitioned SYCL device, an instance ofdpctl.SyclQueue, or adpctl.tensor.Deviceobject returned bydpnp.ndarray.device.Default:
None.usm_type ({"device", "shared", "host"}, optional) -- The type of SYCL USM allocation for the output array. Default:
"device".sycl_queue ({None, SyclQueue}, optional) -- A SYCL queue to use for output array allocation and copying. The sycl_queue can be passed as
None(the default), which means to get the SYCL queue from device keyword if present or to use a default queue. Default:None.
- Returns:
out -- Random values in a given shape
(d0, d1, ..., dn). Output array data type isdpnp.float64if a device supports it, ordpnp.float32type otherwise.- Return type:
dpnp.ndarray
See also
dpnp.random.randomReturn random floats in the half-open interval
[0.0, 1.0).dpnp.random.random_sampleReturn random floats in the half-open interval
[0.0, 1.0).dpnp.random.uniformDraw samples from a uniform distribution.
Examples
>>> import dpnp as np >>> s = np.random.rand(3, 2)