np.random.permutation is a NumPy function that returns a random permutation of a sequence. It randomly shuffles the elements of the given sequence.

Here is an example usage:

import numpy as np

sequence = np.array([1, 2, 3, 4, 5])
permutation = np.random.permutation(sequence)

print(permutation)

Output:

[4 3 1 5 2]

In this example, np.random.permutation is used to generate a random permutation of the sequence [1, 2, 3, 4, 5]. The output is a new array with the elements shuffled randomly

nprandompermutation

原文地址: https://www.cveoy.top/t/topic/hLch 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录