   Pseudo-random number problem
  Hi there. I'm trying to get a random number between something pre-determined and 100, without going over 100.Here's what I have now:guess = (rand() % 100 + (lastGuess + 1));The problem is, it will sometimes choose numbers over 100 if the random number + lastGuess is over 100. Can anyone help me?   
  Well, in order to make sure you don't go over 100 after you add lastGuess, you have to generate a random number between 0 and 100 minus the last guess.  Something like:guess = (rand() % (100 - lastGuess)) + (lastGuess + 1)Say your last number was 20, then it would generate a random number between 0 and 80 and add the 21, so the number would always be between the last guess (20) and 100.-Jeff   ;  A random number between A and B is the same thing as a random number between 0 and (B-A), plus A.   