rand() % 99 + 1 will give you 100. If the random number is 99+1, do the math in your head. %100 + 1 will be 101.