dpnp.random.RandomState.randint

method

RandomState.randint(low, high=None, size=None, dtype=<class 'int'>, usm_type='device')[source]

Draw random integers from low (inclusive) to high (exclusive).

Return random integers from the “discrete uniform” distribution of the specified type in the “half-open” interval [low, high).

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

Parameters:

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

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 or int, but int value is considered to be exactly equivalent to dpnp.int32. Otherwise, numpy.random.RandomState.randint(low, high, size, dtype) samples are drawn.

Examples

>>> s = dpnp.random.RandomState().randint(2, size=10)
>>> print(s)
[0 1 1 1 1 0 0 0 0 1]

See also

dpnp.random.RandomState.random_integers

similar to randint, only for the closed interval [low, high], and 1 is the lowest value if high is omitted.