fix: widen instance seed/state types in random/streams/randu#12567
Draft
Planeshifter wants to merge 1 commit into
Draft
fix: widen instance seed/state types in random/streams/randu#12567Planeshifter wants to merge 1 commit into
seed/state types in random/streams/randu#12567Planeshifter wants to merge 1 commit into
Conversation
The `Options` interface already allows `name` to be `'minstd'` or `'minstd-shuffle'` in addition to `'mt19937'`, and the stream forwards `seed`/`state` from the underlying PRNG (`@stdlib/random/base/randu`), which selects a MINSTD generator for those names. A MINSTD state is an `Int32Array` (`PRNGStateMINSTD`), but the instance `seed`/`state` members were typed as MT19937-only, so the declared types rejected valid MINSTD shapes. Widen both to include the MINSTD variants, matching the `Options` interface and the sibling random/base/randu declaration.
Contributor
Coverage Report
The above coverage report was generated for the changes in this PR. |
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
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This pull request:
seedandstatemember types inrandom/streams/randuto include the MINSTD variants.The
Optionsinterface already permits selecting a MINSTD generator:and the stream forwards
seed/statefrom the underlying PRNG (@stdlib/random/base/randu), which selects a MINSTD generator whennameis'minstd'/'minstd-shuffle'. A MINSTD state is anInt32Array(PRNGStateMINSTD), distinct from MT19937'sUint32Array. However, the instance members were typed MT19937-only:so the declared types rejected valid MINSTD shapes. This widens both to match the
Optionsinterface and the siblingrandom/base/randudeclaration (which already uses the union):Related Issues
No.
Questions
No.
Other
Identified during a TypeScript-declaration audit of the
@stdlib/randomnamespace and verified againstlib/main.js, thebase/randufactory, and the@stdlib/types/randomseed/state definitions.Checklist
AI Assistance
If you answered "yes" above, how did you use AI assistance?
Disclosure
A TypeScript-declaration audit surfaced this issue using Claude Code; the finding was independently verified against the implementation and the
base/randureference, and reviewed by myself before submitting.@stdlib-js/reviewers