Mir Random [WIP]

Ilya Yaroshenko via Digitalmars-d digitalmars-d at puremagic.com
Wed Nov 23 03:03:33 PST 2016


On Wednesday, 23 November 2016 at 10:33:21 UTC, Joseph Rushton 
Wakeling wrote:
> On Wednesday, 23 November 2016 at 05:26:12 UTC, Ilya Yaroshenko 
> wrote:
>> [...]
>
> All of which is fine in its own terms, but why prioritize the 
> speed of the default behaviour over its reliability and 
> reproducibility?
>
> Anyone who cares about that combination of speed and 
> statistical quality will have enough information in the 
> documentation to know what to do.  By contrast producing 
> different results for identical user code depending on whether 
> you're making a 32- or 64-bit build is an unpleasant 
> complication it could be better to avoid.
>
> In any case, given what you say above, shouldn't the choice of 
> 32- vs. 64-bit RNG depend on whether one is using a 
> distribution that generates 32- vs. 64-bit floating-point 
> variates, rather than whether one is building for a 32- or 
> 64-bit target?  In which case it needs to be a user choice, 
> since it's only the user who knows what distribution they're 
> using.

We have a Random alias. I think it is OK if it generates 
different numbers for different arch and library versions. If a 
user want to exact the same behaviour he can use explicit names 
like Mt19937_32 and Mt19937_64. Both are defined for all 
architectures.

64-bit has not significant speed degradation on 64-bit machines 
for 32-bit random number generation. Maybe only few %. So it is 
better for 64-bit machines.

It is only question of `Random` alias, which can be changed in 
the future anyway. Both Mt19937_32 and Mt19937_64 are defined.


More information about the Digitalmars-d mailing list