bundles / scipy latest / scipy / _lib / _util / rng_integers
function
scipy._lib._util:rng_integers
source: /scipy/_lib/_util.py :722
Signature
def rng_integers ( gen , low , high = None , size = None , dtype = int64 , endpoint = False ) Summary
Return random integers from low (inclusive) to high (exclusive), or if endpoint=True, low (inclusive) to high (inclusive). Replaces RandomState.randint (with endpoint=False) and RandomState.random_integers (with endpoint=True).
Extended Summary
Return random integers from the "discrete uniform" distribution of the specified dtype. If high is None (the default), then results are from 0 to low.
Parameters
gen: {None, np.random.RandomState, np.random.Generator}Random number generator. If None, then the np.random.RandomState singleton is used.
low: int or array-like of intsLowest (signed) integers to be drawn from the distribution (unless high=None, in which case this parameter is 0 and this value is used for high).
high: int or array-like of intsIf provided, one above the largest (signed) integer to be drawn from the distribution (see above for behavior if high=None). If array-like, must contain integer values.
size: array-like of ints, optionalOutput shape. If the given shape is, e.g., (m, n, k), then m * n * k samples are drawn. Default is None, in which case a single value is returned.
dtype: {str, dtype}, optionalDesired dtype of the result. All dtypes are determined by their name, i.e., 'int64', 'int', etc, so byteorder is not available and a specific precision may have different C types depending on the platform. The default value is 'int64'.
endpoint: bool, optionalIf True, sample from the interval [low, high] instead of the default [low, high) Defaults to False.
Returns
: out: int or ndarray of intssize-shaped array of random integers from the appropriate distribution, or a single such random int if size not provided.
Aliases
-
scipy.cluster.vq.rng_integers