I have the following inputs (verified by NSLog): xleft = 128, xRight = 192
. The next line of code uses these-
xPos = (arc4random() % xRight-xleft) + xleft;
On the last run, xPos = 53. By my calculations, it should be no less than 128 if the random number produced is zero (192 - 128 = 64, rand(64) = 0, 0 + 128 = 128
. I am trying to generate random numbers in the range xLeft to xRight.