fork download
  1. #include <iostream>
  2. #include <random>
  3.  
  4. int main() {
  5. std::random_device device;
  6. std::mt19937 generator(device());
  7. std::uniform_int_distribution<int> dist(0, 1);
  8.  
  9. for (int i = 0, j = 0; i * j < 20; ++((dist(generator) == 1) ? i : j)) {
  10. std::cout << i << ", " << j << std::endl;
  11. }
  12. return 0;
  13. }
Success #stdin #stdout 0s 3472KB
stdin
Standard input is empty
stdout
0, 0
0, 1
0, 2
0, 3
1, 3
1, 4
2, 4
2, 5
3, 5
3, 6