how to shuffle two lists the same way python code example
Example 1: python shuffle two lists in the same way
import random
your_list_1 = ['the', 'original', 'order']
your_list_2 = [1, 2, 3]
joined_lists = list(zip(your_list_1, your_list_2))
random.shuffle(joined_lists)
your_list_1, your_list_2 = zip(*joined_lists)
print(your_list_1)
print(your_list_2)
--> ('the', 'order', 'original')
--> (1, 3, 2)
Example 2: python shuffle two lists together
from sklearn.utils import shuffle
a_shuffled, b_shuffled = shuffle(np.array(a), np.array(b))