https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94087

--- Comment #20 from rguenther at suse dot de <rguenther at suse dot de> ---
On Thu, 14 May 2020, redi at gcc dot gnu.org wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94087
> 
> --- Comment #19 from Jonathan Wakely <redi at gcc dot gnu.org> ---
> If you mean the mersenne twister in the std::random_device object, that's a
> union member and doesn't exist when a proper source (/dev/random, rdrand,
> rdseed etc) is available. So we'd need to add *another* mersenne twister 
> object
> (which would double the size of std::random_device, changing ABI, or have to 
> be
> global and protected by a mutex, or thread-local) and we'd have to seed it so
> it's not 100% deterministic, and MT has a state size of 19968 bits which needs
> a lot of seeding. It's not a good choice for many reasons.

Doh.  OK, guess I'd set up the twister in all cases and make it 
programatically skip itself when rdrand/rdseed is available so we
could easily fall back to it.  Not sure what extra state there is
that warrants the union, but well ... I suppose simply calling
random() from the C library isn't an option ;)

Reply via email to