Implemented stdlib.h

This commit is contained in:
2024-10-25 12:01:54 +02:00
parent a797d4366a
commit 18d1b7de6a
8 changed files with 156 additions and 24 deletions
+15
View File
@@ -0,0 +1,15 @@
#include <stdlib.h>
// taken from glibc
#define RAND_A 1103515245
#define RAND_C 12345
static size_t _next = 1;
int rand(void) {
_next = (RAND_A * _next + RAND_C) & RAND_MAX;
return (int)(_next % (size_t)(RAND_MAX + 1));
}
void srand(size_t seed) { _next = seed; }