fork(1) download
  1. #include <iostream>
  2. #include <random>
  3. #include <functional>
  4.  
  5. int main() {
  6. using namespace std;
  7. random_device seeder;
  8.  
  9. auto dist = bind(uniform_int_distribution<int>(0, 1), mt19937_64(seeder()));
  10.  
  11. if(dist() == 0) {
  12. cout << "You won!\n";
  13. } else {
  14. cout << "Sorry, you lost.\n";
  15. }
  16. }
Success #stdin #stdout 0s 3276KB
stdin
Standard input is empty
stdout
You won!