13 lines
246 B
C
13 lines
246 B
C
|
#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;
|
||
|
}
|