Mir Random [WIP]

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


On 11/23/2016 06:14 AM, Ilya Yaroshenko wrote:
> I think that Range API is bad and useless overengineering for RNGs.

So it either "takes 1 minute" to change the interface from opCall to 
ranges (i.e. they're virtually the same thing), or it's the above. 
There's precious little overengineering that can be done in 1 minute 
:o). I see you did that in a dozen lines in RandomRangeAdaptor.

I understand you believe the range interface is unnecessary or overkill 
for random number generators. I may even agree for certain cases. 
However, there are a few arguments you may want to consider:

* By virtue of working with D, everybody know what a range is. 
Presenting the RNGs that way instantly evokes a host of knowledge, 
understanding, and idioms.

* D users (or at least a fraction) and several algorithms understand the 
notion of an infinite range and make salient decisions based on that. A 
range interface automatically taps into that.


Andrei


More information about the Digitalmars-d mailing list