randomize the range from which keys are chosen