Open horenmar opened 10 months ago
Thank you for your suggestion! It seems reasonable, but it would require an ABI-breaking change. We can consider implementing it in the vNext version (not Visual Studio 2022).
vNext note: Resolving this issue will require breaking binary compatibility. We won't be able to accept pull requests for this issue until the vNext branch is available. See https://github.com/microsoft/STL/issues/169 for more information.
Yeah I know, I talked with STL somewhere and he said to open an issue so it might happen in vNext.
LCGs are garbage but if there were a better option than mt19937[_64]
then we should consider it for vNext. There appears to be nothing technically preventing default_random_engine
from being a choice outside the Standard set, so it could be an implementation of PCG or some other algorithm.
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.