版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/Arctic_Beacon/article/details/85279690
train_data 和 train_label保持对应
state = np.random.get_state()
np.random.shuffle(train_data)
np.random.set_state(state)
np.random.shuffle(train_label)
原理
numpy.random.
set_state
(state)
Set the internal state of the generator from a tuple.
import numpy as np
state = np.random.get_state()
chance = np.random.permutation(20)
np.random.set_state(state)
chance2 = np.random.permutation(20)
print(chance,chance2)
输出
[13 17 7 1 4 12 15 8 3 16 5 6 11 18 2 14 9 10 0 19] [13 17 7 1 4 12 15 8 3 16 5 6 11 18 2 14 9 10 0 19]