cupy.random.randint(low, high=None, size=None, dtype='l')[source]#

Returns a scalar or an array of integer values over [low, high).

Each element of returned values are independently sampled from uniform distribution over left-close and right-open interval [low, high).

  • low (int) – If high is not None, it is the lower bound of the interval. Otherwise, it is the upper bound of the interval and lower bound of the interval is set to 0.

  • high (int) – Upper bound of the interval.

  • size (None or int or tuple of ints) – The shape of returned value.

  • dtype – Data type specifier.


If size is None, it is single integer sampled. If size is integer, it is the 1D-array of length size element. Otherwise, it is the array whose shape specified by size.

Return type:

int or cupy.ndarray of ints