<p>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.</p>
<p>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).</p>
<p>The <a href="https://github.com/vigna/MRG32k3a" rel="nofollow noreferrer">latest implementation</a> by Vigna of MRG32k3a is fast on CPUs.</p>
<p>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.</p>

CC BY-SA 4.0
2022-07-26T09:54:05.860Z
2022-07-26T09:54:05.860Z
jherek
<p>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.</p>

<p>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 <a href="http://www.thesalmons.org/john/random123/papers/random123sc11.pdf" rel="noreferrer">some authors</a> claim it has good statistical performance. It's also nearly twenty years old, though, and the paper linked above is dated from 2011.</p>

<p>Is MRG32k3a still considered an effective PRNG? Is it an effective alternative to PCG and modern Xorshift?</p>

<p>If not, what else should I use? Philox seems <a href="https://www.shadertoy.com/view/XslBR4" rel="noreferrer">interesting</a>, but it's another old technique (published 2011) and I'm not sure if it's been superseded in the meantime.</p>

<ul>
<li>MRG32k3a MKL <a href="https://software.intel.com/en-us/mkl-vsnotes-mrg32k3a" rel="noreferrer">entry</a></li>
<li><a href="http://simul.iro.umontreal.ca/rng/MRG32k3a.c" rel="noreferrer">Example</a> implementation from L'Ecuyer's paper</li>
<li>The <a href="https://www.researchgate.net/publication/261858547_Good_Parameters_and_Implementations_for_Combined_Multiple_Recursive_Random_Number_Generators" rel="noreferrer">paper</a> itself</li>
</ul>

<pathtracing><gpu><sampling><noise><simulation>
Does MRG32k3a compare well with PCG and Xorshift256*?
Paul Ferris
# Does MRG32k3a compare well with PCG and Xorshift256*?

(Asked by: username_0 on 2018-10-28)

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](http://www.thesalmons.org/john/random123/papers/random123sc11.pdf) 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](https://www.shadertoy.com/view/XslBR4), but it's another old technique (published 2011) and I'm not sure if it's been superseded in the meantime.

* MRG32k3a MKL [entry](https://software.intel.com/en-us/mkl-vsnotes-mrg32k3a)
* [Example](http://simul.iro.umontreal.ca/rng/MRG32k3a.c) implementation from L'Ecuyer's paper
* The [paper](https://www.researchgate.net/publication/261858547_Good_Parameters_and_Implementations_for_Combined_Multiple_Recursive_Random_Number_Generators) itself

**Tags:** pathtracing, gpu, sampling, noise, simulation


---

## 1 answers

### Answer by username_1 on 2022-07-26. Score: 3

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](https://github.com/vigna/MRG32k3a) 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.


---

