FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

BUG: restore RandomState multinomial stream compatibility by vetrovk · Pull Request #32300 · numpy/numpy · GitHub

/ numpy Public

BUG: restore RandomState multinomial stream compatibility - #32300

Draft
vetrovk wants to merge 1 commit into
numpy:mainfrom
vetrovk:fix/randomstate-multinomial-stream
Draft

BUG: restore RandomState multinomial stream compatibility#32300
vetrovk wants to merge 1 commit into
numpy:mainfrom
vetrovk:fix/randomstate-multinomial-stream

Conversation

vetrovk commented Aug 15, 2026

Copy link
Copy Markdown

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.

Copy link
Copy Markdown
Member

I'm converting this to draft because the discussion in #32299 is leaning toward just documenting the behavior change.

ngoldbaum marked this pull request as draft August 18, 2026 16:46
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

00 - Bug 09 - Backport-Candidate PRs tagged should be backported

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DOC: Output of RandomState.multinomial() changed in v2.5.0

3 participants


Back | FazBrowse Home | New Git URL