fork download
  1. #include <iostream>
  2. #include <string>
  3. #include <random>
  4.  
  5. int main(int argc, const char *argv[])
  6. {
  7. for (int i=0; i < 5; ++i) {
  8. uint_fast32_t seed = argc > 1 ? std::atoi(argv[1]) : 2;
  9. std::mt19937 generator{seed};
  10. std::uniform_int_distribution<int> dist(0, 999);
  11. std::cout << "Iteration: " << i + 1 << "===========\n";
  12. for (int j = 0; j < 20; ++j) {
  13. std::cout << dist(generator) << ' ';
  14. }
  15. std::cout << '\n';
  16. }
  17.  
  18. return 0;
  19. }
  20.  
Success #stdin #stdout 0.01s 5508KB
stdin
Standard input is empty
stdout
Iteration: 1===========
435 185 25 931 549 947 435 484 420 320 330 154 204 698 619 119 299 485 266 632 
Iteration: 2===========
435 185 25 931 549 947 435 484 420 320 330 154 204 698 619 119 299 485 266 632 
Iteration: 3===========
435 185 25 931 549 947 435 484 420 320 330 154 204 698 619 119 299 485 266 632 
Iteration: 4===========
435 185 25 931 549 947 435 484 420 320 330 154 204 698 619 119 299 485 266 632 
Iteration: 5===========
435 185 25 931 549 947 435 484 420 320 330 154 204 698 619 119 299 485 266 632