aboutsummaryrefslogtreecommitdiffstats
path: root/random.h
diff options
context:
space:
mode:
Diffstat (limited to 'random.h')
-rw-r--r--random.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/random.h b/random.h
new file mode 100644
index 0000000..fb0c7b3
--- /dev/null
+++ b/random.h
@@ -0,0 +1,14 @@
+#ifndef RANDOM_H
+#define RANDOM_H
+
+#include <random>
+
+inline double randomN()
+{
+ static std::uniform_real_distribution<double> distribution (0.0, 1.0);
+ static std::mt19937 generator;
+ return distribution(generator);
+}
+
+#endif // RANDOM_H
+