implemented randomize