import numpy as np
old_order=np.array([0,1,2,3,4,5,6,7,8])
new_order=old_order
swap_1,swap_2=random.sample(range(0,9),2)
new_order[swap_1],new_order[swap_2]=old_order[swap_2],old_order[swap_1]
print(old_order,new_order)
So I am trying to swap two random element within an array. old_order would be the original array and new_order would be the array after the switch happened. What I don't understand is that why would the values of the old_order be changed
I have narrow down the problem to
new_order[swap_1],new_order[swap_2]=old_order[swap_2],old_order[swap_1]
If this line is remove, both new order and old order will be the same.