How to Create Two the Same Random Order Array In Numpy

If you have two array and want to shuffle them with the same random order, hwo to do?

Here is an examples:

import numpy as np

list_1 = np.array([1,2,3,4,5,6,7,8,9])
list_2 = np.array([11,12,13,14,15,16,17,18,19])

print list_1
# [1 2 3 4 5 6 7 8 9]
print list_2
# [11 12 13 14 15 16 17 18 19]
perm = np.arange(np.size(list_1,0)) #
np.random.shuffle(perm)
list_1 = list_1[perm]
list_2= list_2[perm]

print list_1
# [7 3 4 2 5 9 8 6 1]
print list_2
# [17 13 14 12 15 19 18 16 11]

From the result, you can find the random order in list_1 and list_2 is the same.

,