just wondering, if I have the following code:
int randomNum = rand() % 18 + (-9);
will this create a random number from -9 to 9?
No, it won't. You're looking for:
int randomNum = rand() % 19 + (-9);
There are 19 distinct integers between -9 and +9 (including both), but rand() % 18 only gives 18 possibilities. This is why you need to use rand() % 19.
rand() % 18
rand() % 19