I'm having some difficulty here in my code which is as follows, I know that to generate random numbers between 0
and 9
is - x = rand() % 10
.
So now I wanted to generate numbers between -99
and 99
, and I did this way - x = (rand()%200)-100
, the problem is that in negative numbers it generates the number -100
, and in the positives it only generates itself to 99
, as is intended.
How do I generate from -99
and not -100
?