changed randomize function to generate a series of random legal moves, instead of flips