2 ms·
Greatly appreciate this, particularly the simple C implementation. I had extracted the 32x2 variant from pcg-c in a similar manner. Only became aware of the DXS
by dundarious 3y ago
Greatly appreciate this, particularly the simple C implementation. I had extracted the 32x2 variant from pcg-c in a similar manner. Only became aware of the DXSM variant yesterday via numpy, while researching python PRNGs. I was hoping to find an identical 32x2 implementation. Hopefully this will make my job of sharing an identical PRNG in python and C much easier, as I can switch to DXSM. I just hope the uint128_t requirement isn't too onerous (for freestanding environments, etc.)
Also of note in the space of tiny little implementations you can copy-paste anywhere is JSF. I make no claims about its suitability for any task, but I really like how its implementation is presented: https://burtleburtle.net/bob/rand/smallprng.html https://burtleburtle.net/bob/rand/smallprng.html
- fanf2 3y agoIf uint128_t turns out to be a problem, you can grab the 128-bit compatibility code from the PCG distribution or from NumPy. The NumPy implementation has the wide arithmetic inlined by hand into its PCG function. (I will add a note about this to my article)