np.random.permutation(): Randomly arrange the sequence.
Example 1: Randomly sort the sequence between 0-5
Example 2: Randomly sort a list
What's going on in multiple dimensions?
a matrix output is:
Now look at the c matrix, I ran it twice:
the first run result:
Then, I ran it again:
Through this example, it can be seen that for a multi-dimensional input, only random sorting is performed on the first dimension.
For this 3×3 matrix, just sort the rows randomly.