fork(2) download
  1. #include <random>
  2. #include <iostream>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8. random_device rd; // non-deterministic generator
  9. mt19937 gen(rd()); // to seed mersenne twister.
  10. // replace the call to rd() with a
  11. // constant value to get repeatable
  12. // results.
  13.  
  14. for (int i = 0; i < 5; ++i) {
  15. cout << gen() << " "; // print the raw output of the generator.
  16. }
  17. cout << endl;
  18. }
Success #stdin #stdout 0s 4412KB
stdin
Standard input is empty
stdout
1648116335 102021799 3730225732 1780570480 2511048077