I wrote the following code to flip two values in rows of 2d numpy array. However, I am wondering if there is a better way to do this. thanks in advance
def mtn(offg):
for row in range(offg.shape[0]):
point1 = random.randint(0, 139)
point2 = random.randint(0, 139)
temp = offg[row, point1]
offg[row, point1] = offg[row, point2]
offg[row, point2] = temp
return offg