dpnp.random.uniform¶
- dpnp.random.uniform(low=0.0, high=1.0, size=None, device=None, usm_type='device', sycl_queue=None)[source]¶
Draw samples from a uniform distribution.
Samples are uniformly distributed over the half-open interval [low, high) (includes low, but excludes high). In other words, any value within the given interval is equally likely to be drawn by uniform.
For full documentation refer to
numpy.random.uniform.- Parameters:
- 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 adpnp.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:
- outdpnp.ndarray
Drawn samples from the parameterized uniform distribution. Output array data type is the same as input dtype. If dtype is
None(the default),dpnp.float64type will be used if device supports it, ordpnp.float32otherwise.
Limitations
Parameters low and high are supported as a scalar. Otherwise,
numpy.random.uniform(low, high, size)samples are drawn. Parameter dtype is supported only asdpnp.int32,dpnp.float32,dpnp.float64orNone.See also
dpnp.random.randomFloats uniformly distributed over
[0, 1).
Examples
Draw samples from the distribution:
>>> low, high = 0, 0.1 # low and high >>> s = dpnp.random.uniform(low, high, 10000)