On Sunday, 15 May 2016 at 14:25:44 UTC, Basile B. wrote:
The wrapper could be smaller with an alias this:

[... snip ...]

even if I'm not 100% sure if this is conform with previous version. At least the tests pass.

I'm surprised that one passes the test,

   static assert(!isForwardRange!SafeRNG);

... ? Or did you only try the tests applied to the dxorshift generators?

More generally: what I'd be worried about with this version is that it readily re-opens the door to accidentally copying the underlying RNG by value, if (as with Phobos RNGs) the postblit is not disabled.

The wrapper I provided is more verbose, but it should guarantee statistical safety in that respect.

I also have a personal bugbear about `alias this` inasmuch as the current permissions constraints _force_ the exposure of implementation details (i.e. the `getGen` method has to be public), but that's more of a frustration than a serious worry in this case ;-)
  • dxorshift: random numbe... Joseph Rushton Wakeling via Digitalmars-d-announce
    • Re: dxorshift: ran... Basile B. via Digitalmars-d-announce
      • Re: dxorshift:... Joseph Rushton Wakeling via Digitalmars-d-announce
        • Re: dxorsh... Joseph Rushton Wakeling via Digitalmars-d-announce
          • Re: dx... Joseph Rushton Wakeling via Digitalmars-d-announce
            • R... Basile B. via Digitalmars-d-announce
              • ... Joseph Rushton Wakeling via Digitalmars-d-announce
                • ... Basile B. via Digitalmars-d-announce
                • ... Joseph Rushton Wakeling via Digitalmars-d-announce
                • ... Joseph Rushton Wakeling via Digitalmars-d-announce
                • ... ag0aep6g via Digitalmars-d-announce
          • Re: dx... Joseph Rushton Wakeling via Digitalmars-d-announce
            • R... jmh530 via Digitalmars-d-announce
              • ... Kagamin via Digitalmars-d-announce
              • ... Joseph Rushton Wakeling via Digitalmars-d-announce

Reply via email to