[Bug target/94087] std::random_device often fails when used from multiple threads

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu May 14 12:02:51 GMT 2020


--- Comment #22 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to rguenther@suse.de from comment #20)
> 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 ;)

Mersenne twister is just a bad choice, period.

We could fit a linear_congruential_engine in the unused space of the union.

More information about the Gcc-bugs mailing list