#include <stdint.h>

typedef struct {
  uint32_t a;
  uint32_t c;
  uint64_t m;
  uint32_t x_n;
} lcg_t;

void init_lcg(int seed, lcg_t* gen){
  gen->a = 1664525;
  gen->c = 1013904223;
  gen->m = (1ULL << 32);
  gen->x_n = seed;
}

uint32_t lcg(lcg_t* gen){
    gen->x_n = (gen->a * gen->x_n + gen->c) % gen->m;
    return gen->x_n;
}
