aboutsummaryrefslogtreecommitdiff
path: root/src/dice.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/dice.cc')
-rw-r--r--src/dice.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/dice.cc b/src/dice.cc
new file mode 100644
index 0000000..dd7db55
--- /dev/null
+++ b/src/dice.cc
@@ -0,0 +1,11 @@
+#include "dice.h"
+#include <random>
+
+namespace dice {
+ std::mt19937 gen(std::random_device{}());
+
+ int roll(int d) {
+ std::uniform_int_distribution<> dist(1, d);
+ return dist(gen);
+ }
+}