On Sunday, 15 May 2016 at 09:20:22 UTC, Joseph Rushton Wakeling wrote:
http://code.dlang.org/packages/dxorshift
https://github.com/WebDrake/dxorshift

[...]

The generators are all implemented as structs, but in order to prevent some known problems with unintended copy-by-value of RNGs, the postblit has been disabled. For similar reasons, these generators are implemented as input ranges, not forward ranges, so that library functionality cannot copy generator state under the hood.

`dup` properties are however provided for all generators, to allow the programmer to deliberately copy RNG state.

Testing, feedback and general usage are all welcome. I am planning on submitting these to Phobos (although sorting out the generic side of things might be a good idea first).

Nice,

The "@disable this" is really a concern, because pointers have to be used (for example if the seed comes from a program option and that the gen is a global var then global var must be a pointer to the stuff).

I see that you are yourself affected by the issue because in the unittest you must take the gen address to use it in take .

The main consequence is that they are unsable in @safe code !
  • 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

Reply via email to