summaryrefslogtreecommitdiff
path: root/stage3/rng.c
diff options
context:
space:
mode:
authorLizzy Fleckenstein <lizzy@vlhl.dev>2023-12-23 04:45:48 +0100
committerLizzy Fleckenstein <lizzy@vlhl.dev>2023-12-23 04:45:48 +0100
commit2237fd9d5081a25ae52b19d2efc381a9b48aa6da (patch)
tree1a5558e67815013fe502c3d0a3885c61336f3c26 /stage3/rng.c
parent12f914b5a51e34308437f9a4eccbb33142b3565f (diff)
downloadcuddles-2237fd9d5081a25ae52b19d2efc381a9b48aa6da.tar.xz
seed rng at startup
Diffstat (limited to 'stage3/rng.c')
-rw-r--r--stage3/rng.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/stage3/rng.c b/stage3/rng.c
index a52b449..01e6597 100644
--- a/stage3/rng.c
+++ b/stage3/rng.c
@@ -1,9 +1,14 @@
#include "rng.h"
+static unsigned long int next = 1;
+
int rand()
{
- static unsigned long int next = 1;
-
next = next * 1103515245 + 12345;
return (unsigned int) (next/65535) % 32768;
}
+
+void srand(int seed)
+{
+ next = seed;
+}