4
I’m having some difficulty here in my code which is the following, 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 so as follows - x = (rand()%200)-100
, the problem is that in the negative numbers it generates the number -100
, and in the positive only generates even the 99
, as is intended.
How should I generate from the -99
and not of -100
?
Oh yes I understood, now it worked. Thanks!
– Samuel_Rocha