Quote Originally Posted by bigtamscot
whats wrong with plain and simple

for a random number >=5 & <= 10.

int num = (rand % 6) + 5;
Quote Originally Posted by Dave Evans
but the lower few bits may not be uniformly distributed
That said, I tend to use the Mersenne Twister algorithm for pseudo-random numbers, an implementation in C++ is available here