title: Is there a C++11 CSPRNG?
body: <p>As we know, the Mersenne Twister <a href="http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/efaq.html" rel="noreferrer">is not crytographically secure</a>:</p>
  
  <blockquote>
    <p>Mersenne Twister is not cryptographically secure. (MT is based on a
    linear recursion. Any pseudorandom number sequence generated by a
    linear recursion is insecure, since from sufficiently long subsequencje
    of the outputs, one can predict the rest of the outputs.)</p>
  </blockquote>
  
  <p>But many sources, like <a href="//channel9.msdn.com/Events/GoingNative/2013/rand-Considered-Harmful" rel="noreferrer">Stephan T. Lavavej</a> and even <a href="//stackoverflow.com/a/7114482/5287986">this website</a>. The advice is almost always (verbatim) to use the Mersenne Twister like this:</p>
  
  <pre><code>auto engine = mt19937{random_device{}()};
  </code></pre>
  
  <p><sub>They come in different flavors, like using <code>std::seed_seq</code> or complicated ways of manipulating <code>std::tm</code>, but this is the simplest approach.</sub></p>
  
  <p>Even though <code>std::random_device</code> <a href="http://en.cppreference.com/w/cpp/numeric/random/random_device" rel="noreferrer">is not always reliable</a>:</p>
  
  <blockquote>
    <p><code>std::random_device</code> may be implemented in terms of an
    implementation-defined pseudo-random number engine if a
    non-deterministic source (e.g. a hardware device) is not available to
    the implementation. In this case each <code>std::random_device</code> object may
    generate the same number sequence.</p>
  </blockquote>
  
  <p>The <code>/dev/urandom</code> vs <code>/dev/random</code> debate <a href="http://www.2uo.de/myths-about-urandom/" rel="noreferrer">rages on</a>.</p>
  
  <p>But while the standard library provides a good collection of PRNGs, it doesn't seem to provide any CSPRNGs. I prefer to stick to the standard library rather than using POSIX, Linux-only headers, etc. Can the Mersenne Twister be manipulated to make it cryptographically secure?</p>