4
$\begingroup$

I've been using standard 32-bit Xorshift in my GPU path-tracer for a while, following Nathan Reed's approach with hashed seeds and decorrelated state. I (finally) discovered today that Xorshift is considered obsolete and I should use a 64-bit+ PRNG instead for better-distributed values, but I obviously can't fake the operations needed for PCG and modern Xorshift without expensive software arithmetic.

So, I've been considering the MRG32k3a hash by Pierre L'Ecuyer. It uses doubles instead of uint64s, it's included in Intel's Math Kernel Library, and some authors claim it has good statistical performance. It's also nearly twenty years old, though, and the paper linked above is dated from 2011.

Is MRG32k3a still considered an effective PRNG? Is it an effective alternative to PCG and modern Xorshift?

If not, what else should I use? Philox seems interesting, but it's another old technique (published 2011) and I'm not sure if it's been superseded in the meantime.

$\endgroup$

1 Answer 1

0
$\begingroup$

Short answer is yes. MRG32k3a has withstood the test of time, much more than PCG or XorShift256*. In fact, a recent paper by Matsumoto (creator of Mersenne-Twister) shows some poor properties of XorShift128 variants. So going 64-bit is not the answer.

64-bit is also ambiguous. The question indirectly assumes 64-bit+ of state. It could also mean the size of the one random integer output in bits. MRG32k3a will give you (almost) 32-bit numbers as output (I think actually 31).

The latest implementation by Vigna of MRG32k3a is fast on CPUs.

MRG32k3a has also a relatively efficient skip to arbitrary positions in the stream, which may be useful for multithreading, although there are faster alternatives, the fastests generators to skip are counter based generators derived from crypto, such as Chacha or Philox. But they are also slower in general at generating a single number. Finally Xoshiro256++, used in the Julia programming language by default, offers a decent compromise between fast generation and efficient skip.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.