RandomState.permutation()

numpy.random.RandomState.permutation

RandomState.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:

x : int 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:

out : ndarray

Permuted sequence or array range.