There has been a discussion started about using PCG64 as the PRNG for the next version of the Perl interpreter. We need a simple C function to process PRNG requests so we based our implementation off of the SmokeRand PCG64_64 generator. I poked around the full library code available in this repo and there are a lot of macros and function wrappers that obscure the algorithm. Below is the generator code we landed on:
typedef struct { uint64_t state; uint64_t inc; } pcg64_random_t;
uint64_t pcg64_rand64()
{
const uint64_t word = ((prng.state >> ((prng.state >> 59) + 5)) ^ prng.state) * 12605985483714917081ull;
prng.state = prng.state * 6364136223846793005ull + prng.inc;
return (word >> 43) ^ word;
}
Can you please sanity check our code to make sure we deconstructed the macros and functions appropriately? We want to triple confirm the algorithm is correct before we launch.
There has been a discussion started about using PCG64 as the PRNG for the next version of the Perl interpreter. We need a simple C function to process PRNG requests so we based our implementation off of the SmokeRand PCG64_64 generator. I poked around the full library code available in this repo and there are a lot of macros and function wrappers that obscure the algorithm. Below is the generator code we landed on:
Can you please sanity check our code to make sure we deconstructed the macros and functions appropriately? We want to triple confirm the algorithm is correct before we launch.