sysprog-basic/include/rand.c

16 lines
328 B
C

#include "adc.h"
int rand() {
static unsigned int seed = 1337191337;
seed *= adc_read(3);
unsigned int buf[] = {
(seed*31832)%677,
(seed*32932)%2332
};
seed = buf[1]*223238;
seed *= seed << 4;
seed %= 410829;
seed = buf[0] * 1892823 % 23891;
seed = buf[0];
return seed;
}