method
Generator.permutation(x) Randomly permute a sequence, or return a permuted range.
If x is a multi-dimensional array, it is only shuffled along its first index.
| Parameters: | 
  |  
|---|---|
| Returns: | 
  |  
>>> rng = np.random.default_rng() >>> rng.permutation(10) array([1, 7, 4, 3, 0, 9, 2, 5, 8, 6]) # random
>>> rng.permutation([1, 4, 9, 12, 15]) array([15, 1, 9, 4, 12]) # random
>>> arr = np.arange(9).reshape((3, 3))
>>> rng.permutation(arr)
array([[6, 7, 8], # random
       [0, 1, 2],
       [3, 4, 5]])
 
    © 2005–2019 NumPy Developers
Licensed under the 3-clause BSD License.
    https://docs.scipy.org/doc/numpy-1.17.0/reference/random/generated/numpy.random.Generator.permutation.html