I\'m trying to make a game with dice, and I need to have random numbers in it (to simulate the sides of the die. I know how to make it between 1 and 6). Using
This code produces random numbers from n to m.
n
m
int random(int from, int to){ return rand() % (to - from + 1) + from; }
example:
int main(){ srand(time(0)); cout << random(0, 99) << "\n"; }