Bug 20746 – Change LCG in garbage collector treap to use full 64 bits of state instead of 48
Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P1
Component
druntime
Product
D
Version
D2
Platform
All
OS
All
Creation time
2020-04-19T05:10:03Z
Last change time
2020-05-20T09:24:03Z
Keywords
pull
Assigned to
No Owner
Creator
Nathan S.
Comments
Comment #0 by n8sh.secondary — 2020-04-19T05:10:03Z
rt.util.random.Rand48 is an LCG that holds its state in a 64-bit long but only makes use of the low 48 bits. Replacing it with an LCG that makes use of the full 64 bits would be a strict improvement as it would take no additional space and would not be slower.
Rand48 is used only in rt.util.container.treap.Treap which in turn is used only by the garbage collector.
Comment #1 by dlang-bot — 2020-04-19T05:43:38Z
@n8sh created dlang/druntime pull request #3042 "Change LCG in garbage collector treap to use full 64 bits of state instead of 48" fixing this issue:
- Fix Issue 20746 - Change LCG in garbage collector treap to use full 64 bits of state instead of 48
https://github.com/dlang/druntime/pull/3042
Comment #2 by dominikus — 2020-04-19T07:15:44Z
Sorry, but there was no bug and this is NOT an improvement.
The generator output is 32 bit and the internal state of course will use the whole 64 bit (even if not from the start), but it put out bits from the middle of the state.
Output the lowest 32 bits will make it less "random" - if fact very predictable.
Please, this is not a good pseudo-random number generateor, but at least it worked. now its destroyed.
Revert this change!
Comment #3 by dlang-bot — 2020-05-20T09:24:03Z
dlang/druntime pull request #3042 "Change LCG in garbage collector treap to use full 64 bits of state instead of 48" was merged into master:
- 275a33117e5266da65cb5a6393634bbdde7fd00d by Nathan Sashihara:
Fix Issue 20746 - Change LCG in garbage collector treap to use full 64 bits of state instead of 48
https://github.com/dlang/druntime/pull/3042