I would like to generate a random number between 0 and 3 and I have the following in my code:
int random = rand() % 4;
This works fine but
how many numbers have you tested this on? if it is actually true you can instead generate a range from say 0->3999 using a = rand()%4000 and use int = a/1000 this should remove the weight of the apparently under produced zero.
a = rand()%4000
int = a/1000