bctpy icon indicating copy to clipboard operation
bctpy copied to clipboard

Update RNG usage with numpy's new interface

Open clbarnes opened this issue 2 years ago • 1 comments

get_rng is now just a thin wrapper around numpy.random.default_rng, which reduces the set of types which could be used as a seed but improves consistency. default_rng may change the underlying algorithm in future numpy releases, which means that results are not necessarily stable for the same seed across numpy versions; as such, users can pass their BitGenerator of choice in the seed argument, and tests are hard-coded to use today's preferred algorithm.

Updating from the deprecated RNG (where the algorithm wasn't even selectable) to today's preferred one required changing all of the hardcoded reference values in the tests. For most, this was a pretty minor difference within reason for changing the random seed, but in a couple of cases the change was more significant. I'm not sure how best to check whether this is "real" or not.

Additionally removed EOL python versions from tox and added more recent releases.

Travis may be dead so I'll look into github actions instead.

clbarnes avatar Sep 08 '22 13:09 clbarnes

Rebased on the GHA branch used in #109

clbarnes avatar Sep 08 '22 14:09 clbarnes