I would like to shuffle a 1-d numpy array, with the constraint that no elements match the corresponding elements (ie., same index) from another array of the same shape. It can be assumed that all elements of each array are unique.
For example,
a = np.arange(10)
b = a.copy()
np.random.shuffle(b)
np.where(a==b) # This should be empty
What's the best way? Any ideas?