You could just use a while loop and generate a random int. You are already doing that but with more unnecesary steps.