My engine's random number generator code is open source!
By DUCK_BERET
August 8, 2025
Categories: Game Development | Tools
Recently I talked about making parts of my engine's utility code easier to reuse and releasing them as open source. The only issue was that lots of the code relies on some memory arena code that has not yet been made available under an open source license.
The good news is that my random number generation code doesn't have that problem! The random number generator algorithm itself (PCG-XSH-RR by Melissa O'Neill) is available under the Apache license and everything else is my own code. So I released the code as a single-header C library and made all of my own code (i.e. everything outside of the function that advances the random number generator's state) public domain.
If you want to take a look at how my engine's random number generation code works and what functionality it has (e.g. the option of making sure you never roll the same number two or three times in a row, or making sure you don't roll the same as any of the past 5 rolls etc), check it out! And of course, feel free to use or adapt any of my code in that file to your own games.


