working beta of the randomization script