<random>
Pick a different backing random number engine for default_random_engine
#4257
Labels
decision needed
We need to choose something before working on this
vNext
Breaks binary compatibility
Currently it is alias for
mt19937
.mt19937
is not a bad generator on its own, but it is not a good default. The reason is that MTs are excessively large, sosizeof(default_random_engine) == 5000
right now. This is much larger than the user would reasonably expect, for comparison, xoshiro fits into 16-32 bytes, PCG usually fits into 8-16, common LCGs will be 8. WELLs can be as large as MTs, but there are also reasonably sized variants at 32 bytes.The choice of
default_random_engine
also has knock-on effects beyond just the direct users, e.g. the simple random utilities wanted to use a thread-local instance ofdefault_random_engine
, but that means shoving 5k objects into the TLS. As I understand it, there is nothing really blocking that, but it is not great.The text was updated successfully, but these errors were encountered: