Skip to content

Use rng everywhere #40

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

Merged
merged 28 commits into from
Mar 7, 2023
Merged

Use rng everywhere #40

merged 28 commits into from
Mar 7, 2023

Conversation

fabian-sp
Copy link
Owner

No description provided.

@fabian-sp
Copy link
Owner Author

Remark to myself: we drop assertions for now because it seems that it is hard/impossible to create identical random numbers accross machines/versions for numpy.

See: numpy/numpy#22975

@fabian-sp fabian-sp merged commit 1b28e1b into f-fda-and-mask Mar 7, 2023
@fabian-sp fabian-sp deleted the f-use-rng branch March 7, 2023 15:35
@@ -216,13 +220,15 @@ def sample_covariance_matrix(Sigma, N, seed = None):
return: sample covariance matrix S
"""
if seed is not None:
np.random.seed(seed)

rng = np.random.default_rng(seed)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do this unconditionally. default_rng(None) will pull random entropy from the OS and will be vastly more likely to give you a distinct PRNG than np.random.randint(low=11111, high=99999) will.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, thanks for the hint! Will adjust this

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

Successfully merging this pull request may close these issues.

2 participants