On Saturday, 26 November 2016 at 20:13:36 UTC, Andrei Alexandrescu wrote:
On 11/26/16 11:31 AM, Ilya Yaroshenko wrote:
Hey,

32-bit Mt19937 random number Generator is default in Phobos.
It is default in Mir too, except that 64-bit targets use 64-bit Mt19937 instead.

Congrats! Also thanks for using the Boost license which would allow backporting the improvements to Phobos. Who'd be up for it?

PR is now on Phobos, and in the process of looking at this together, Ilya and I resolved a number of issues both in this code and in mir.random:
https://github.com/dlang/phobos/pull/5011

There is unfortunately one serious blocker to this PR. In order to allow it to be a drop-in replacement for the previous Phobos implementation, I had to find a means to default-initialize its internal state at compile time so that it would match what would be there if it was explicitly seeded with the default seed.

The method I developed works fine with LDC, but fails with DMD: the internal state of the generator winds up as all zeros, except for the `State.z` parameter which mysteriously ends up at the correct value. This would suggest that somehow the generated state is being overwritten _after_ being correctly generated, rather than not correctly generated in the first place.

Any chance that someone with more CTFE-fu than myself could take a glance and advise what might be wrong (or how to work around it)?

Reply via email to