Added randomization function