C++ Logo


Advanced search

Re: Comments for P0205 and P2060: Mersenne twister can actually generate 7 and 13

From: Thiago Macieira <thiago_at_[hidden]>
Date: Wed, 17 Nov 2021 16:57:21 -0800
On Wednesday, 17 November 2021 14:05:15 PST Lénárd Szolnoki via Std-Proposals
> random_device random number sources by standard library:
> * libstdc++ : /dev/urandom by default
> * libc++ : getentropy() which uses getrandom()
> * MS STL : rand_s() which in turn uses RtlGenRandom()

Quick correction: libstdc++'s default uses rdseed first, then rdrand, and if
both of those are out of entropy after 100 attempts each, it throws. I'm not
sure that's a good design, but it is what's there. If you run on a CPU without
either, then it uses arc4random() or getentropy() or /dev/urandom.

Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel DPG Cloud Engineering

Received on 2021-11-17 18:57:27