larray.random.permutation¶
-
larray.random.
permutation
(x, axis=0)[source]¶ Randomly permute a sequence along an axis, or return a permuted range.
- Parameters
- xint or array_like
If x is an integer, randomly permute
sequence(x)
. If x is an array, returns a randomly shuffled copy.- axisint, str or Axis, optional
Axis along which to permute. Defaults to the first axis.
- Returns
- LArray
Permuted sequence or array range.
Examples
>>> la.random.permutation(10) # doctest: +SKIP {0}* 0 1 2 3 4 5 6 7 8 9 6 8 0 9 4 7 1 5 3 2 >>> la.random.permutation([1, 4, 9, 12, 15]) # doctest: +SKIP {0}* 0 1 2 3 4 1 15 12 9 4 >>> la.random.permutation(la.ndtest(5)) # doctest: +SKIP a a3 a1 a2 a4 a0 3 1 2 4 0 >>> arr = la.ndtest((3, 3)) # doctest: +SKIP >>> la.random.permutation(arr) # doctest: +SKIP a\b b0 b1 b2 a1 3 4 5 a2 6 7 8 a0 0 1 2 >>> la.random.permutation(arr, axis='b') # doctest: +SKIP a\b b1 b2 b0 a0 1 2 0 a1 4 5 3 a2 7 8 6