Additionally, the second link says that the following code should return a number from 1 to 10:Actually, it produces numbers from 0 to 9. If you're looking for random numbers in a range, try this:Code:(int)( (double)std::rand() / ( RAND_MAX + 1 ) * 10 )Code:int random(int low, int high) { return ((int)((double)std::rand() / (RAND_MAX+1) * (high-low+1)) + low); }