Mir Random [WIP]

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Wed Nov 23 05:56:27 PST 2016


On 11/23/2016 08:26 AM, 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.

Well I do see another small problem with 
https://github.com/libmir/mir-random/blob/master/source/random/algorithm.d#L19. 
It creates the first value eagerly upon construction. That's just a bit 
awkward. It's not the first time I'm seeing this issue, and to be honest 
am a bit bummed about it. It's a consequence of all ranges needing to 
buffer at least one element. -- Andrei


More information about the Digitalmars-d mailing list