Skip to content

Add routine to allow initialization from another RNG #9

Description

@rfourquet

It's currently possible to initialize an RNG from a uint32_t value or from an array thereof. If I understand correctly, these seeds then get mixed somehow to fill up the internal state, and finally some invariants are enforced:

    initial_mask(dsfmt);
    period_certification(dsfmt);
    dsfmt->idx = DSFMT_N64;

Sometimes you might already have another RNG ready, from which you would like to initialize a dSFMT RNG. With the current dSFMT API, you have to create an random array of uint32_t of some arbitrary length and pass it to dsfmt_init_by_array. But it's somewhat slow, and this is mixing an already random seed.

It would be great to be able to directly randomize the state, and be able to call the "invariants routines" (initial_mask and period_certification, which are currently marked static, and so are not callable from a shared library). Or better yet, have a new API function which does these three steps (quoted code above) at once.

I would be happy to provide a patch if this receives positive feedback.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions