How would I determine the probability of a given number occuring in the follow code? Just how bad is the infamous rand()?
I need another test loop and 20 variables to increment(?). I'm a little over my head on this.Code:#include<iostream> #include<ctime> int main() { srand(time(0)); int testCases = 100; for(int i = 1; i <= testCases; i++) { int x = rand()%20+1; std::cout<<x<<'\t';} std::cin.get(); return 0; }
Thanks -
JM