1
0
mirror of https://github.com/sehugg/8bitworkshop.git synced 2024-11-15 14:07:16 +00:00
8bitworkshop/presets/base_z80/prng.c

9 lines
127 B
C
Raw Normal View History

unsigned int lfsr = 1;
unsigned int rand() {
char lsb = lfsr & 1;
lfsr >>= 1;
if (lsb) lfsr ^= 0xd400;
return lfsr;
}