fork download
  1. #include <iostream>
  2. #include <random>
  3. using namespace std;
  4.  
  5. int main() {
  6. default_random_engine generator;
  7. bernoulli_distribution distribution(0.5);
  8. for(size_t i = 0; i < 10; ++i)
  9. cout << (distribution(generator)? 'X' : 'O') << endl;
  10. return 0;
  11. }
Success #stdin #stdout 0s 3296KB
stdin
Standard input is empty
stdout
X
X
X
O
O
O
X
O
X
X