juegos

Juegos de terminal de Pancho: Catan (TUI, GUI, web, servidor, PicoCalc), ajedrez, calculadora y minijuegos
git clone https://git.lu3dhn.xyz/juegos.git
Log | Files | Refs

rng.h (342B)


      1 /* rng.h - PCG32 (O'Neill): determinista y portable, sin estado global. */
      2 #ifndef COMUN_RNG_H
      3 #define COMUN_RNG_H
      4 #include <stdint.h>
      5 
      6 typedef struct Rng { uint64_t state, inc; } Rng;
      7 void     rng_seed(Rng *r, uint64_t seed, uint64_t seq);
      8 uint32_t rng_next(Rng *r);
      9 uint32_t rng_below(Rng *r, uint32_t n);    /* 0..n-1 sin sesgo */
     10 
     11 #endif