summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Simianer <p@simianer.de>2014-10-03 15:18:42 +0100
committerPatrick Simianer <p@simianer.de>2014-10-03 15:18:42 +0100
commite14fc9af4e74a2ed05361224fd13ed4cc61479ec (patch)
treecbeb25f49a594df0fd497c9f1686c9f1078ceba9
parent4b17bf95f2d367116e45d73f2282390d8a688e9c (diff)
c,cc: rand.cc
-rw-r--r--c,cc/rand.cc14
1 files changed, 14 insertions, 0 deletions
diff --git a/c,cc/rand.cc b/c,cc/rand.cc
new file mode 100644
index 0000000..6be97a6
--- /dev/null
+++ b/c,cc/rand.cc
@@ -0,0 +1,14 @@
+#include <iostream>
+#include <random>
+
+int main()
+{
+ std::random_device rd;
+ std::mt19937 gen(rd());
+ std::uniform_int_distribution<> dis(2, 3);
+
+ for (int n=0; n<10; ++n)
+ std::cout << dis(gen) << ' ';
+ std::cout << '\n';
+}
+