Quote Originally Posted by JonathanS
rand( value % 100 ) is in the range 0 to 99
rand( value % 100 + 1 ) is in the range 1 to 100
rand( value % 30 + 1985 ) is in the range 1985 to 2014
This is either a mistake or some very misleading notation.
You mean something like:
Code:
value = rand() % 100;
value = rand() % 100 + 1;
value = rand() % 30 + 1985;
Quote Originally Posted by JonathanS
correspond to miliseconds on your computer clock
time() usually returns seconds (usually since Jan 1, 1970), not milliseconds.

And in this code
Quote Originally Posted by JonathanS
Code:
        int range_hit = 16;
        int r = rand()%20;
        if(r<=range_hit)
The if condition actually has a 17 out of 20 (85%) chance of being true.

Since Valdo wants a 70% chance of a bullseye, this would be a good way of doing it:
Code:
if (rand() <= (RAND_MAX / 10) * 7) {
    // 70% chance of executing this block
}
else {
    // 30% chance of executing this block
}