dpnp.random.randint
- dpnp.random.randint(low, high=None, size=None, dtype=<class 'int'>, device=None, usm_type='device', sycl_queue=None)[source]
Return random integers from low (inclusive) to high (exclusive).
For full documentation refer to
numpy.random.randint
.- 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 ofdpctl.SyclDevice
corresponding to a non-partitioned SYCL device, an instance ofdpctl.SyclQueue
, or a Device object returned bydpnp.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. 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 -- size-shaped array of random integers from the appropriate distribution, or a single such random int if size is not provided. Output array data type is the same as input dtype.
- Return type:
dpnp.ndarray
Limitations
Parameters low and high are supported only as a scalar. Parameter dtype is supported only as
dpnp.int32
orint
, butint
value is considered to be exactly equivalent todpnp.int32
. Otherwise,numpy.random.RandomState.randint(low, high, size, dtype)
samples are drawn.Examples
Draw samples from the distribution:
>>> low, high = 3, 11 # low and high >>> s = dpnp.random.randint(low, high, 1000, dtype=dpnp.int32)
See also
dpnp.random.random_integers
similar to randint, only for the closed interval [low, high], and 1 is the lowest value if high is omitted.