avr/base/src/base.c

13 lines
246 B
C
Raw Normal View History

2022-05-07 23:49:54 +00:00
#include "../base.h"
rng_t rng_new(uint8_t seed) {
return { .mod = 255, .a = 253, .c = 41, .seed = seed };
}
uint8_t rng_sample(rng_t *state) {
state->seed = (state->a * state->seed + state->c) % state->mod;
return state->seed;
}