meta: move photon/libc to root

This commit is contained in:
2026-02-08 20:45:25 +00:00
parent f00e74260d
commit 345a37962e
140 changed files with 0 additions and 0 deletions

31
libc/stdlib/rand.c Normal file
View File

@@ -0,0 +1,31 @@
#include <stddef.h>
static unsigned int seed = 0;
void srand(unsigned int _seed)
{
seed = _seed;
}
int rand(void)
{
int next = seed;
int result;
next *= 1103515245;
next += 12345;
result = (int)(next / 65536) % 2048;
next *= 1103515245;
next += 12345;
result <<= 10;
result ^= (int)(next / 65536) % 1024;
next *= 1103515245;
next += 12345;
result <<= 10;
result ^= (int)(next / 65536) % 1024;
seed = next;
return result;
}