dask 2021.10.0

NotesParametersReturnsBackRef
random_integers(self, low, high=None, size=None, chunks='auto', **kwargs)

This docstring was copied from numpy.random.mtrand.RandomState.random_integers.

Some inconsistencies with the Dask version may exist.

Return random integers of type :None:None:`np.int_` from the "discrete uniform" distribution in the closed interval [`low`, :None:None:`high`]. If :None:None:`high` is None (the default), then results are from [1, :None:None:`low`]. The :None:None:`np.int_` type translates to the C long integer type and its precision is platform dependent.

This function has been deprecated. Use randint instead.

deprecated

Notes

To sample from N evenly spaced floating-point numbers between a and b, use:

a + (b - a) * (np.random.random_integers(N) - 1) / (N - 1.)

Parameters

low : int

Lowest (signed) integer to be drawn from the distribution (unless high=None , in which case this parameter is the highest such integer).

high : int, optional

If provided, the largest (signed) integer to be drawn from the distribution (see above for behavior if high=None ).

size : int or tuple of ints, optional

Output 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.

Returns

out : int or ndarray of ints

:None:None:`size`-shaped array of random integers from the appropriate distribution, or a single such random int if :None:None:`size` not provided.

Random integers of type :None:None:`np.int_` between :None:None:`low` and :None:None:`high`, inclusive.

See Also

randint

Similar to :None:None:`random_integers`, only for the half-open interval [`low`, :None:None:`high`), and 0 is the lowest value if :None:None:`high` is omitted.

Examples

This example is valid syntax, but we were not able to check execution
>>> np.random.random_integers(5)  # doctest: +SKIP
4 # random
This example is valid syntax, but we were not able to check execution
>>> type(np.random.random_integers(5))  # doctest: +SKIP
<class 'numpy.int64'>
This example is valid syntax, but we were not able to check execution
>>> np.random.random_integers(5, size=(3,2))  # doctest: +SKIP
array([[5, 4], # random
       [3, 3],
       [4, 5]])

Choose five random numbers from the set of five evenly-spaced numbers between 0 and 2.5, inclusive (i.e., from the set ${0, 5/8, 10/8, 15/8, 20/8}$ ):

This example is valid syntax, but we were not able to check execution
>>> 2.5 * (np.random.random_integers(5, size=(5,)) - 1) / 4.  # doctest: +SKIP
array([ 0.625,  1.25 ,  0.625,  0.625,  2.5  ]) # random

Roll two six sided dice 1000 times and sum the results:

This example is valid syntax, but we were not able to check execution
>>> d1 = np.random.random_integers(1, 6, 1000)  # doctest: +SKIP
... d2 = np.random.random_integers(1, 6, 1000) # doctest: +SKIP
... dsums = d1 + d2 # doctest: +SKIP

Display results as a histogram:

This example is valid syntax, but we were not able to check execution
>>> import matplotlib.pyplot as plt  # doctest: +SKIP
... count, bins, ignored = plt.hist(dsums, 11, density=True) # doctest: +SKIP
... plt.show() # doctest: +SKIP
See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

dask.array.random.RandomState.tomaxint dask.array.random.RandomState.randint dask.array.random.RandomState.uniform

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


File: /dask/array/random.py#383
type: <class 'function'>
Commit: