Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

All random generation should be settable with numpy random generator #146

Open
paucodeici opened this issue Aug 30, 2024 · 1 comment
Open

Comments

@paucodeici
Copy link

I am not aware of where exactly there are call to numpy.random but it should be call to some random number generator fed in the function.

Typically pointpats.random.poisson( rng=np.random.default_rng(???)) or specify a seed or something

Can do the change but I am not aware if it would break anything or would be long and painful change.

@martinfleis
Copy link
Member

Fully agree. Right now we call individual functions from numpy.random inside our functions like here

candidate = numpy.random.multivariate_normal((0, 0), replication_cor)
or here
numpy.random.uniform(bbox[0], bbox[2]),
numpy.random.uniform(bbox[1], bbox[3]),

If you want to fix the random seed, you need to use the global numpy.random.seed. We should transition towards random generator support. The change should not be too complicated. We just need to expose rng and use methods on rng to draw random samples instead of current functions.

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

No branches or pull requests

3 participants