Created
December 29, 2015 11:39
-
-
Save ayyess/5376ea7b61c5b1defb54 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <random> | |
class Maybe { | |
std::mt19937 rng; | |
std::bernoulli_distribution coin; | |
public: | |
operator bool() { return coin(rng); } | |
} maybe; | |
#include <iostream> | |
using std::cout; | |
using std::endl; | |
int main(int argc, char *argv[]) | |
{ | |
for (int i = 0; i < 10; ++i) { | |
bool a = maybe; | |
cout << a << endl; | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment