| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
I'm converting this to draft because the discussion in #32299 is leaning toward just documenting the behavior change. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
PR summary
Fixes #32299.
This restores the pre-2.5 random stream behavior of RandomState.multinomial without reverting the Generator.multinomial fix from #31238.
The regression was caused by routing RandomState.multinomial through legacy_random_binomial, which changed both zero-probability RNG consumption and the inversion path. This PR adds a multinomial-specific legacy helper that preserves the previous behavior while retaining the corrected Generator behavior.
Regression tests cover the reported sequence, RNG stream consumption, the inversion path, and the existing BTPE behavior.
First time committer introduction
Hi, I'm Kirill. This is my first contribution to NumPy.
I came across #32299 while looking for a small bug I could help with. I was interested in it because the change affects reproducibility of the legacy RandomState API. I reproduced the issue on different NumPy versions and worked through the regression to understand what had changed.
I'm still getting familiar with the NumPy codebase, so feedback is very welcome.
AI Disclosure
I used OpenAI Codex as a development assistant for repository exploration, reproducing the issue, tracing the relevant code paths, implementing the fix, and running tests and validation.
I reviewed and understood the resulting changes and verified the behavior and test results myself. The pull request is being submitted and all project communication is being handled by me.