summaryrefslogtreecommitdiff
path: root/Source/Library/Common/Rand.ns.cpp
diff options
context:
space:
mode:
authorAlexis211 <alexis211@gmail.com>2009-10-20 19:23:33 +0200
committerAlexis211 <alexis211@gmail.com>2009-10-20 19:23:33 +0200
commit768ada13917aeda373e6ff5fee21faf90c963746 (patch)
tree9e26d7d65e1693d1a7f9fd93c9fd33b41d175464 /Source/Library/Common/Rand.ns.cpp
parent6ec4b3d31080f90393e72989d559cfb76eff6f9d (diff)
parent9836acd720988af30250c2c1ec18d618664dea4e (diff)
downloadMelon-768ada13917aeda373e6ff5fee21faf90c963746.tar.gz
Melon-768ada13917aeda373e6ff5fee21faf90c963746.zip
Merge branch 'usermode_syscalls'
Conflicts: Source/Kernel/Makefile
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;
+}
+
+}