fork download
  1. #include <iostream>
  2. #include <iomanip>
  3. #include <cstdlib>
  4. using namespace std;
  5.  
  6. int main() {
  7.  
  8. srand(0xbeef);
  9.  
  10. cout << setprecision(2) << fixed;
  11.  
  12. int testCnt = 10*1000, arr[11] = {};
  13. for(int i = 0; i < testCnt; i++)
  14. ++arr[rand()%6 + rand()%6];
  15.  
  16. for(int i = 0; i < 11; i++)
  17. cout << arr[i] * 1.0 / testCnt << " ";
  18. cout << "\n";
  19.  
  20. return 0;
  21. }
Success #stdin #stdout 0s 3296KB
stdin
Standard input is empty
stdout
0.03 0.05 0.08 0.11 0.14 0.16 0.14 0.12 0.09 0.05 0.03