Created randomize function