Mir Random [WIP]

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


On Wednesday, 23 November 2016 at 05:58:47 UTC, Ilya Yaroshenko 
wrote:
> ### Example of API+implementation bug:
>
> #### Bug: RNGs has min and max params (hello C++). But, they 
> are not used when an uniform integer number is generated : 
> `uniform!ulong` / `uniform!ulong(0, 100)`.
>
> #### Solution: In Mir Rundom any RNGs must generate all 
> 8/16/32/64 bits uniformly. It is RNG problem how to do it.

Alternative solution: functionality that expects the full 
unsigned integer word (UIntType) to be filled with random bits, 
should validate that the min/max values of the generator 
correspond to UIntType.min and UIntType.max.

That introduces less breaking change, creates less divergence 
with the C++11 standard, and preserves more flexibility for the 
future.


More information about the Digitalmars-d mailing list