There should also be a check in the loop for the number of iterations. If the random number runs from 1-100, for example, after the 100th time the program will loop forever.