magnifik
- 350
- 0
there are 1000 valid results, but 1 is invalid. in other words, 99.9% of the results are valid. what is the error rate for this to be possible?
basically right now i have these facts -- if A has more than B, A wins. in order for a result to be considered "valid," A must have more wins than B. below is a code with 15% error rate. my question is how do i find the error rate for the above restraints?
basically right now i have these facts -- if A has more than B, A wins. in order for a result to be considered "valid," A must have more wins than B. below is a code with 15% error rate. my question is how do i find the error rate for the above restraints?
Code:
int main(){
int A = 0;
int B = 0;
int aWins = 0;
int errorPercent = 15; // errorPercent% of the time, the comparison will be incorrect
srand(time(0));
for (int j = 0; j < 1000; j++){
for (int i = 0; i < 1000000; i++){
if ((rand()%2) == 0)
if( (rand()%100) + 1 > errorPercent )
B++;
else
A++;
else
if( (rand()%100) + 1 > errorPercent )
A++;
else
B++;
}
if (A > B)
aWins++;
}