aboutsummaryrefslogtreecommitdiff
path: root/src/utility.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/utility.cpp')
-rw-r--r--src/utility.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/utility.cpp b/src/utility.cpp
index 7126cbbdc..924324b90 100644
--- a/src/utility.cpp
+++ b/src/utility.cpp
@@ -88,4 +88,18 @@ const v3s16 g_26dirs[26] =
// 26
};
+static unsigned long next = 1;
+
+/* RAND_MAX assumed to be 32767 */
+int myrand(void)
+{
+ next = next * 1103515245 + 12345;
+ return((unsigned)(next/65536) % 32768);
+}
+
+void mysrand(unsigned seed)
+{
+ next = seed;
+}
+