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

Should we consider moving from legacy numpy RandomState to Random.Generator? #27008

Closed
lucyleeow opened this issue Aug 4, 2023 · 1 comment
Closed
Labels
Needs Triage Issue requires triage

Comments

@lucyleeow
Copy link
Member

lucyleeow commented Aug 4, 2023

Numpy RandomState is now legacy ("This generator is considered frozen and will have no further improvement") and the documentation advises against using it:

This class should only be used if it is essential to have randoms that are identical to what would have been produced by previous versions of NumPy.

However, it sounds like RandomState will always work:

It is guaranteed to produce the same values as the final point release of NumPy v1.16.

NEP19 also says

All current usages of RandomState will continue to work in perpetuity, though some may be discouraged through documentation.

numpy.random.Generator was introduced in version 1.17 (specifically this PR) - our min dep is higher than this.

I don't have enough knowledge to know in what way the new generator is better (except for performance) but just asking as it is advised to not use the old one.

(Edit: for context saw this while working on #26958)

@github-actions github-actions bot added the Needs Triage Issue requires triage label Aug 4, 2023
@lucyleeow lucyleeow changed the title Should we consider moving from legacy numpy RandomState to Random Generator? Should we consider moving from legacy numpy RandomState to Random.Generator? Aug 4, 2023
@lucyleeow
Copy link
Member Author

Closing as duplicate!

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

No branches or pull requests

1 participant