summaryrefslogtreecommitdiff
path: root/Source/Library/Common/Rand.ns.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Library/Common/Rand.ns.cpp')
-rw-r--r--Source/Library/Common/Rand.ns.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/Source/Library/Common/Rand.ns.cpp b/Source/Library/Common/Rand.ns.cpp
new file mode 100644
index 0000000..e568678
--- /dev/null
+++ b/Source/Library/Common/Rand.ns.cpp
@@ -0,0 +1,18 @@
+#include "Rand.ns.h"
+
+namespace Rand {
+
+u32int m = 2073741824, a = 50000, b = 1534;
+u64int current = RANDOM_SEED;
+
+u64int rand() {
+ current = (u32int)(a*current + b);
+ while (current > m) current -= m;
+ return current;
+}
+
+u64int max() {
+ return m;
+}
+
+}