aboutsummaryrefslogtreecommitdiff
path: root/src/dice.h
diff options
context:
space:
mode:
authorYour Name <you@example.com>2021-04-13 15:14:34 -0400
committerYour Name <you@example.com>2021-04-13 15:14:34 -0400
commit2ab51e507d620c4479e07ca0ec47d22c8c66bc90 (patch)
tree90906ecb043c01034280c767b83a88eb6df6956f /src/dice.h
downloaddmtool-2ab51e507d620c4479e07ca0ec47d22c8c66bc90.tar.gz
dmtool-2ab51e507d620c4479e07ca0ec47d22c8c66bc90.tar.bz2
dmtool-2ab51e507d620c4479e07ca0ec47d22c8c66bc90.zip
Initial commit
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);
+}