Add randomization code