dask.array.random.permutation

dask.array.random.permutation

dask.array.random.permutation(*args, **kwargs)

Randomly permute a sequence, or return a permuted range.

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

Some inconsistencies with the Dask version may exist.

If x is a multi-dimensional array, it is only shuffled along its first index.

Note

New code should use the ~numpy.random.Generator.permutation method of a ~numpy.random.Generator instance instead; please see the Quick start.

Parameters
xint or array_like

If x is an integer, randomly permute np.arange(x). If x is an array, make a copy and shuffle the elements randomly.

Returns
outndarray

Permuted sequence or array range.

See also

random.Generator.permutation

which should be used for new code.

Examples

>>> np.random.permutation(10)  
array([1, 7, 4, 3, 0, 9, 2, 5, 8, 6]) # random
>>> np.random.permutation([1, 4, 9, 12, 15])  
array([15,  1,  9,  4, 12]) # random
>>> arr = np.arange(9).reshape((3, 3))  
>>> np.random.permutation(arr)  
array([[6, 7, 8], # random
       [0, 1, 2],
       [3, 4, 5]])