[GSoC] Mir.random.flex - Generic non-uniform random sampling

Joseph Rushton Wakeling via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Tue Aug 23 02:51:37 PDT 2016


On Tuesday, 23 August 2016 at 05:40:24 UTC, Ilya Yaroshenko wrote:
> This is an API problem, and will not be fixed. Making D 
> scripting like language is bad for Science. For example, 
> druntime (Fibers and Mutexes) is useless because it is too high 
> level and poor featured in the same time.

Yes, this is not an issue that is immediately fixable without 
introducing other issues (e.g. defining everything as a class 
brings immediate issues related to heap allocation).

In the long run it would obviously be nice to address that issue, 
but it would have been a major blocker to throw that onto Seb's 
shoulders (as we all recognized quite quickly when we started 
discussing it).  It was (rightly) not the focus of this project.

For this reason, the random distributions introduced in mir are 
implemented as functors (as is the case with random distributions 
in C++11 <random>) rather than as ranges.

> The main problem with std.random is that std.random.uniform is 
> broken in context of non-uniform sampling. The same situation 
> is for 99% uniform algorithms. They just ignore the fact that 
> for example, for [0, 1) exponent and mantissa should be 
> generated separately with appropriate probabilities for for 
> exponent

Just as a point of terminology: we should make clear here that 
this is about sampling from a non-uniform distribution.  It 
shouldn't be confused with "sampling" in the sense of what is 
done by (say) `RandomSample`.


More information about the Digitalmars-d-announce mailing list