Mir Random [WIP]

Ilya Yaroshenko via Digitalmars-d digitalmars-d at puremagic.com
Tue Nov 22 21:26:12 PST 2016


On Wednesday, 23 November 2016 at 00:44:26 UTC, Joseph Rushton 
Wakeling wrote:
> On Tuesday, 22 November 2016 at 06:31:45 UTC, Ilya Yaroshenko 
> wrote:
>>  - 64-bit Mt19937 is default for 64-bit targets
>
> This means that seemingly identical code will produce different 
> results depending on whether it's compiled for 64-bit or 
> 32-bit.  Is that really worth it, when anyone who cares about 
> the difference between 32-bit vs. 64-bit random words is quite 
> capable of specifying the RNG they want to use and not just 
> relying on the default?
>
> Having a different default RNG would make sense for targets 
> where there are serious performance issues at stake (e.g. 
> minimal memory available for RNG state) but just for the sake 
> of 32- vs. 64-bit Mersenne Twister seems an unnecessary 
> complication.
>
> These days it's debatable whether Mersenne Twister of _any_ 
> word size is the optimal choice for a default RNG, so if the 
> default is going to be changed, it might as well be to 
> something significantly better (rather than worrying about 
> numbers of bits).

Mir Random is going to be a library with saturated uniform FP 
RNGs and almost saturated exponential FP RNGs. Comparing with all 
other libraries (any language) the basic uniform FP numbers will 
be generated in interval (-1, +1) and contains _all_ possible 
values including all subnormal numbers. 64 bit generators are 2 
times faster for this task if you need to generate a 64 bit 
floating point number. Explanation of technique will be in my 
post/article. --Ilya


More information about the Digitalmars-d mailing list