<p>There are many good generators with a small state: MRG32k3a, LFSR113, Chacha-8, Philox-32x4. Even Mixmax (with N=17) would be small by your standard (state of 17 doubles).</p>
<p>TinyMT is also a possibility, although Vigna has shown that some of the bits are not always good (not sure if the not so great lower bits really matters in practice).</p>
<p>I would be wary of xorshift based rngs, see the paper <a href="https://arxiv.org/abs/1908.10020" rel="nofollow noreferrer">Again, random numbers fall mainly in the planes: xorshift128+ generators</a> by Matsumoto for example. I am also dubious of PCG, if only for the colored table on frontpage of the website: it dumbs things down too much, does not present all the relevant generators, and is skewed towards PCG of course.</p>
How should I choose parameters for a smaller-than-standard std::mersenne_twister_engine?
<p>I need a C++11 random number generator which is "good enough" and which I can save and restore state in. <em>I want the saved state to be significantly smaller</em> than the 6.6kb or so which this code produces</p>

<pre><code>std::mt19937 rng (1);
std::ofstream save ("save.txt");
save &lt;&lt; rng;
</code></pre>

<p><a href="http://www.cplusplus.com/reference/random/mersenne_twister_engine/" rel="noreferrer">std::mersenne_twister_engine</a> has a large number of parameters. It's a bit scary.</p>

<p>For my purposes, a period on the order of billions is sufficient. I've heard of TinyMT, that may be appropriate but can't see how to implement it as a template specialization.</p>

<p>How should I choose the parameters? I suspect it will break badly if I merely reduce the "state size" parameter to a few words.</p>

<p>I would consider using a different engine entirely but, apart from tolerating a moderate period, I don't want to sacrifice the quality of statistical randomness. Artefacts such as the below (for linear congruentals) are unacceptable.</p>

<p><img src="https://i.stack.imgur.com/9NgZc.gif" alt="enter image description here"></p>