Skip to content

switch SLiM's random number generator (RNG) to be faster and better #572

@bhaller

Description

@bhaller

Right now SLiM is using the taus2 RNG included in the GSL for 32-bit draws, and a Mersenne Twister variant for 64-bit draws. These generators are quite old, slow, and (at least in the case of the MT generator, not sure about taus2) statistically imperfect. The PCG family of generators at https://www.pcg-random.org/index.html is much faster (about 3x, by my testing) and statistically very strong, and provide some other benefits that might prove useful as well. I should switch SLiM over. For simulations that lean very heavily on random number generation, this might produce a user-visible performance improvement.

Note that PCG lives on GitHub at https://github.com/imneme/pcg-cpp and that repo has a more recent version of the code than what is provided by the downloads page at https://www.pcg-random.org/index.html. I will use the repo version of the code. There are numerous pull requests on the repo that have not been integrated; I will not adopt any of them unless I hit compile problems somewhere.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions