Skip to content

refactor: migrate to new NumPy RNG API#1148

Open
mmustafasenoglu wants to merge 1 commit into
stumpy-dev:mainfrom
mmustafasenoglu:feat/numpy-rng-migration
Open

refactor: migrate to new NumPy RNG API#1148
mmustafasenoglu wants to merge 1 commit into
stumpy-dev:mainfrom
mmustafasenoglu:feat/numpy-rng-migration

Conversation

@mmustafasenoglu

Copy link
Copy Markdown

Summary

Closes #1112

Updates stumpy core files to use the new NumPy random number generator API (np.random.default_rng()) instead of the legacy API.

Changes

  • floss.py: np.random.seed() + np.random.randint()default_rng().integers()
  • scraamp.py: np.random.permutation()default_rng().permutation()
  • scrump.py: np.random.permutation()default_rng().permutation()
  • core.py: Updated docstring examples to use new API

Note

This PR only updates the core stumpy files. Test files and docstrings will be updated in a follow-up PR as recommended by the issue description.

References

Closes stumpy-dev#1112

Updates stumpy core files to use the new NumPy random number generator
API (np.random.default_rng()) instead of the legacy API.

Changes:
- floss.py: np.random.seed() + np.random.randint() → default_rng().integers()
- scraamp.py: np.random.permutation() → default_rng().permutation()
- scrump.py: np.random.permutation() → default_rng().permutation()
- core.py: Updated docstring examples to use new API

Note: This PR only updates the core stumpy files. Test files and
docstrings will be updated in a follow-up PR.
@mmustafasenoglu mmustafasenoglu requested a review from seanlaw as a code owner July 8, 2026 09:48
@gitnotebooks

gitnotebooks Bot commented Jul 8, 2026

Copy link
Copy Markdown

Review these changes at https://app.gitnotebooks.com/stumpy-dev/stumpy/pull/1148

@seanlaw seanlaw left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@mmustafasenoglu Thank you for your interest. This issue #1112 is currently being worked on in PR #1147. As you'll be able to see, it will require much more effort and consideration than simply replacing the old RNG with the new one.

@seanlaw

seanlaw commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Also, in the future, it would be great if you can keep the original PR checklist template and, following the instructions, run the unit tests locally before submitting the PR (as there are numerous failed tests). Thank you!

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.

Migrate to New NumPy Random Number Generator (RNG) API

2 participants