Simplify randomization code