dc166-patch/runtime/c166l/rand.c
2026-08-26 17:05:24 +03:00

12 lines
238 B
C

static unsigned long random_state = 1UL;
void srand(unsigned int seed)
{
random_state = (unsigned long)seed;
}
int rand(void)
{
random_state = random_state * 1103515245UL + 12345UL;
return (int)((random_state >> 16) & 32767UL);
}