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