On Wednesday, 23 November 2016 at 13:26:41 UTC, Joseph Rushton
Wakeling wrote:
On Wednesday, 23 November 2016 at 13:03:04 UTC, Ilya Yaroshenko
wrote:
Added RandomRangeAdaptor for URBGs:
https://github.com/libmir/mir-random/blob/master/source/random/algorithm.d
This has exactly the problem I identified above, though: you're
unnecessarily cacheing the latest variate rather than just
using the RNG state directly. Not the biggest deal in the
world, but avoidable if you allow a separation between updating
RNG state and accessing it.
1. Current default RNG (Mt19937) has not state for the latest
value.
2. The structure is allocated on stack and compilers can
recognise loop patterns and eliminate addition memory movements
for many cases.