randomization function added