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}, optional) -- An array API concept of device where the output array is created. The device can be None (the default), an OneAPI filter selector string, an instance of dpctl.SyclDevice corresponding to a non-partitioned SYCL device, an instance of dpctl.SyclQueue, or a Device object returned by dpnp.dpnp_array.dpnp_array.device property.

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

  • sycl_queue ({None, SyclQueue}, optional) -- A SYCL queue to use for output array allocation and copying.

Returns:

out -- Drawn samples from the parameterized uniform distribution. Output array data type is the same as input dtype. If dtype is None (the default), dpnp.float64 type will be used if device supports it, or dpnp.float32 otherwise.

Return type:

dpnp.ndarray

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 as dpnp.int32, dpnp.float32, dpnp.float64 or None.

Examples

Draw samples from the distribution:

>>> low, high = 0, 0.1 # low and high
>>> s = dpnp.random.uniform(low, high, 10000)

See also

dpnp.random.random

Floats uniformly distributed over [0, 1).