aboutsummaryrefslogtreecommitdiff
path: root/CST 126/Homework 1/getrandom.hpp
diff options
context:
space:
mode:
authorWesleyR <[email protected]>2024-04-21 21:38:58 -0700
committerWesleyR <[email protected]>2024-04-21 21:38:58 -0700
commit33c72afebeafd9f672f19502f99ffb91caf5f695 (patch)
tree1c0a25ee87ddc504a4020df4458206110eb7ad9e /CST 126/Homework 1/getrandom.hpp
parentupdates (diff)
downloadarchived-homework-1-wesleyr23-33c72afebeafd9f672f19502f99ffb91caf5f695.tar.xz
archived-homework-1-wesleyr23-33c72afebeafd9f672f19502f99ffb91caf5f695.zip
Submission
Diffstat (limited to 'CST 126/Homework 1/getrandom.hpp')
-rw-r--r--CST 126/Homework 1/getrandom.hpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/CST 126/Homework 1/getrandom.hpp b/CST 126/Homework 1/getrandom.hpp
new file mode 100644
index 0000000..8290d71
--- /dev/null
+++ b/CST 126/Homework 1/getrandom.hpp
@@ -0,0 +1,33 @@
+#ifndef GETRANDOM_H
+#define GETRANDOM_H
+
+#include <random>
+
+using std::random_device;
+using std::mt19937;
+using std::uniform_int_distribution;
+
+
+inline int GetRandom(const int upperbound, const int lowerbound)
+{
+ random_device rd; // a seed source for the random number engine
+ mt19937 gen(rd()); // mersenne_twister_engine seeded with rd()
+ uniform_int_distribution<> distrib(lowerbound, upperbound);
+
+
+ return distrib(gen);
+
+
+}
+
+
+
+
+
+
+
+
+
+
+
+#endif \ No newline at end of file