Mir Random [WIP]

Joseph Rushton Wakeling via Digitalmars-d digitalmars-d at puremagic.com
Wed Nov 23 06:02:36 PST 2016


On Wednesday, 23 November 2016 at 13:56:27 UTC, Andrei 
Alexandrescu wrote:
> 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

Yea, this touches on one of my more general concerns related to 
ranges, randomness and laziness.  Part of the trouble is we don't 
have a really good general design for how to implement _truly_ 
lazy ranges, where the value of `front` is not determined until 
the point where you first access it.

This has particular relevance to e.g. RandomSample and 
RandomCover.


More information about the Digitalmars-d mailing list