fork download
  1. #include <random>
  2. #include <iostream>
  3.  
  4. const int N=6;
  5. const int X=1000000;
  6. int main(int, char**)
  7. {
  8. int n1[N]={},n2[N]={};
  9. ::std::random_device rd;
  10. unsigned int s = rd();
  11. ::std::mt19937 g1(s),g2(s);
  12. for( int i=0; i < X; ++i )
  13. {
  14. n1[ g1()%N ]++;
  15. n2[ ::std::uniform_int_distribution<unsigned int>(0, N-1)(g2) ]++;
  16. }
  17. for( int i=0; i < N; ++i )
  18. {
  19. ::std::cout << n1[i] << ", " << n2[i] << ::std::endl;
  20. }
  21. return 0;
  22. }
Success #stdin #stdout 0.03s 3032KB
stdin
Standard input is empty
stdout
166490, 167081
165844, 166500
167148, 166721
166920, 166767
166623, 166827
166975, 166104