New randomize function.