randomize function added