From 2feb8b9e6d0e43cccc877fffc98c3b29c1a62e35 Mon Sep 17 00:00:00 2001 From: drmortalwombat <90205530+drmortalwombat@users.noreply.github.com> Date: Mon, 9 May 2022 22:18:34 +0200 Subject: [PATCH] Add srand to stdlib --- include/stdlib.c | 6 +++++- include/stdlib.h | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/include/stdlib.c b/include/stdlib.c index 9c33212..d1d14a1 100644 --- a/include/stdlib.c +++ b/include/stdlib.c @@ -444,7 +444,7 @@ void * calloc(int num, int size) return p; } -unsigned seed = 31232; +static unsigned seed = 31232; unsigned int rand(void) { @@ -454,3 +454,7 @@ unsigned int rand(void) return seed; } +void srand(unsigned int s) +{ + seed = s; +} diff --git a/include/stdlib.h b/include/stdlib.h index 9a93b87..51f1a49 100644 --- a/include/stdlib.h +++ b/include/stdlib.h @@ -29,6 +29,8 @@ void * calloc(int num, int size); unsigned int rand(void); +void srand(unsigned int seed); + #pragma compile("stdlib.c") #endif