Save last index and regenerate random number