This is either a mistake or some very misleading notation.Originally Posted by JonathanS
You mean something like:
Code:value = rand() % 100; value = rand() % 100 + 1; value = rand() % 30 + 1985;time() usually returns seconds (usually since Jan 1, 1970), not milliseconds.Originally Posted by JonathanS
And in this code
The if condition actually has a 17 out of 20 (85%) chance of being true.Originally Posted by JonathanS
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 }