hey guys, im still working on that little turn based game and im trying to add random damage to it. but i think im using rand() wrong.
this is how i am calling it...
i have this function built to take arguements for the random number
and then when i call to it i use
int randomNum(int x,int y)
int random = rand();
int number = (random % y)+x;
in that spot im trying to get a random number between 20-40. but when i run my program i know i am getting a number higher than 40 sometimes...so i must be using rand() wrong. any help would be awesome! Thanks
int damage = randomNum(20,40);