Roguelikes are games that, among other things, have a lot of procedurally generated content. To generate content, we need random numbers. And to get random numbers, we need a pseudo-random number generator.
Not only do we want random numbers, but we want predictable random numbers! We want players to be able to share seeds and see who does better in the same situation, while also giving people a completely fresh experience every time they play.
But we can't just create a PRNG with a seed and be done. If we use the same PRNG for both level generation and combat, for example, then our second level might change based on how many times the player got into a fight!
So we need to be clever about how we create and store our PRNGs, to ensure that the procedurally generated maps are not affected by anything that happens during gameplay.
But if we use the PCG family of PRNGs, our job is a lot easier. There are many variants of PCG, but in this post I'll be referring only to PCG32, the one that generates 32-bit unsigned integers and keeps its state as two 64-bit unsigned integers.
(By the ...