can't this easily be vectorized using np.random.permutation?