chore: add missing rng and factory keywords to random/base PRNGs#13095
Draft
Planeshifter wants to merge 5 commits into
Draft
chore: add missing rng and factory keywords to random/base PRNGs#13095Planeshifter wants to merge 5 commits into
rng and factory keywords to random/base PRNGs#13095Planeshifter wants to merge 5 commits into
Conversation
Adds the `rng` keyword (present in 40/43 = 93.0% of `random/base` siblings; the three omitters are this package, `minstd-shuffle`, and `mt19937`) and the `factory` keyword (present in 36/43 = 83.7% of `random/base` siblings; this package ships `lib/factory.js` and exposes the same factory pattern as `randu`, which carries the keyword). Metadata only; no source or behavioral change.
Adds the `rng` keyword (40/43 = 93.0% sibling conformance in `random/base`) and the `factory` keyword (36/43 = 83.7% conformance; this package ships `lib/factory.js`). Same drift class as sibling `minstd`. Metadata only; no source or behavioral change.
Adds the `rng` keyword (40/43 = 93.0% sibling conformance in `random/base`) and the `factory` keyword (36/43 = 83.7% conformance; this package ships `lib/factory.js` and is the canonical MT19937 generator referenced by sibling PRNGs that already carry both keywords). Metadata only; no source or behavioral change.
Adds the `factory` keyword (present in 36/43 = 83.7% of `random/base` siblings). This package ships `lib/factory.js` and exposes a `factory()` method matching the sibling convention; only the keyword advertisement was missing. Metadata only; no source or behavioral change.
Adds the `factory` keyword (present in 36/43 = 83.7% of `random/base` siblings). This package ships `lib/factory.js` and exposes a `factory()` method matching the sibling convention; only the keyword advertisement was missing. Metadata only; no source or behavioral change.
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 corrects two
package.jsonkeywordsdrift findings in@stdlib/random/base, surfaced by majority-vote analysis across all 43 direct child packages. Five packages were missing one or both of the convention keywordsrngandfactorydespite implementing the relevant pattern; the omissions are normalized to the sibling convention. Metadata only; no source, test, or behavioral change.Namespace summary
@stdlib/random/basepackage.jsontop-level /scripts/directories/keywordsshape, README##/###heading list,manifest.jsonshape,test//benchmark//examples/filenames, public signatures,returnKind, validation prologue (via direct read of everylib/validate.js,lib/factory.js, andlib/main.js), error construction, JSDoc shape,require()-derived dependencies.package.jsontop-level key set (18 keys, 100%);directories.{benchmark,doc,example,lib,test}(100%);main = './lib',types = './docs/types',engines,os(100%); 8 universal keywords (stdlib,stdmath,mathematics,math,statistics,stats,seed,seedable— each 41/43, omitted only byreviver/shared);pseudorandom/generator(42/43);rng(40/43 = 93.0%);factory(36/43 = 83.7%);lib/factory.jspresence (41/43, omitted only byreviver/shared); error construction =format(100% of the 41 packages that throw —reviver/sharedperform no validation); the canonical README sequence## Usage→## Notes→## Examples→## See Also(41/43, omitted only byreviver/shared).manifest.json,binding.gyp,include/,src/,lib/native.js) at 7/43 = 16.3% (tied to whether a package has a C addon, not drift);referencesREADME sub-section (10/43 = 23.3%, content-driven); per-package keyword tails (distribution-specific naming).Per outlier package
random/base/minstdAdds
rngandfactoryto thekeywordsarray. The package implements the Park-Miller LCG and shipslib/factory.jsexposing afactory()constructor matching the sibling convention, yet was absent from the 93.0% of siblings taggedrngand the 83.7% taggedfactory. Insertion followsrandu:rngbetweenprngandpseudorandom,factoryappended afterseedable.random/base/minstd-shuffleAdds
rngandfactoryto thekeywordsarray. The package is a Park-Miller LCG with Bays-Durham shuffle and shipslib/factory.js, but was missing from both the 93.0%rngcohort and the 83.7%factorycohort. Insertion mirrorsrandu.random/base/mt19937Adds
rngandfactoryto thekeywordsarray. This is the canonical 32-bit Mersenne Twister backing every siblingfactory()as the default PRNG, so its omission from the 93.0%rngcohort and 83.7%factorycohort was the most conspicuous gap in the namespace. Insertion followsrandu:rngbetweenprngandpseudorandom,factoryafterseedable.random/base/box-mullerAdds
factoryto thekeywordsarray. The package generates normally distributed values via the Box-Muller transform and shipslib/factory.jswith the standardfactory()constructor, placing it among the 5 outliers excluded from the 83.7% sibling cohort.factoryis appended after the existing trailing keyword.random/base/improved-zigguratAdds
factoryto thekeywordsarray. The package generates normally distributed values via the improved Ziggurat method and shipslib/factory.jswith the standardfactory()constructor, leaving it among the 5 outliers excluded from the 83.7% sibling cohort.factoryis appended after the existing trailing keyword.Related Issues
No.
Questions
No.
Other
Validation
Checked:
package.jsonshape, README headings,manifest.jsonshape,test//benchmark//examples/filenames) across all 43 members.lib/factory.jspresence and shape) across all 43 members by direct read oflib/main.js,lib/factory.js, andlib/validate.js.random/base(fix: widenseed/statetypes in random/base/randi #12568randiTypeScript decl widening; docs: fix TSDoc errors and inconsistencies in random TypeScript declarations #12571 random-namespace TSDoc fixes; feat: addrandom/base/tinymt32#6177 / feat(random): add a new pseudorandom number generatorrandom/base/xorshift32#6333 / feat(random): add a new pseudorandom number generatorrandom/base/pcg32#6551 / feat: add xorshift32 pseudorandom number generator #10343 / feat: xorshift128plus pseudorandom generator #11089 new-PRNG additions) are disjoint from this run's outlier set.rng-cohort omitters (minstd,minstd-shuffle,mt19937) share an older template that predates therng-keyword convention used by every other PRNG in the namespace; the fivefactory-cohort omitters all shiplib/factory.jsand expose afactory()matchingrandu._toolsconsumers ofpackage.jsonkeywords(the package-search lunr index in_tools/search/pkg-index, the namespace-TOC filter in_tools/markdown/namespace-toc, and the published-package GitHub-topics mapper in_tools/scripts/publish_packages) all treat the array additively. All additions satisfy thepackage-json/schemakeyword regex and remain unique within each array.rng40/43,factory36/43) and that the majority pattern is what should be applied. The two packages excluded from thefactorycohort that are NOT outliers (reviver,shared) genuinely lacklib/factory.jsand are correctly excluded.Deliberately excluded:
random/base/reviverandrandom/base/shared— missingrng,factory,pseudorandom,generator,lib/factory.js,benchmark/benchmark.js,examples/index.js, and the canonical README sequence. These are infrastructure packages (a JSON reviver and a shared-API module respectively); the omissions reflect their genuinely different purpose and are intentional deviations rather than drift.directories.include/directories.srcsplit (35/43 vs 7/43) — tied to whether a package has a native C addon, not drift.lognormal,gumbel,weibull) — local to each package's subject matter; not drift candidates.## Referencessection (10/43 = 23.3% prevalence) — content-driven, no clear majority.A local report with the full audit trail (feature distributions, dropped candidates and rationale, namespace random seed) lives at
~/drift-reports/drift-random-base-2026-06-24.md.Checklist
AI Assistance
If you answered "yes" above, how did you use AI assistance?
Disclosure
This PR was authored by Claude Code running as a scheduled cross-package drift-detection routine targeting
@stdlib/random/base. Structural and semantic features were extracted across all 43 namespace members, deviations from the ≥75% majority pattern were surfaced, and three independent reviewer agents (opus semantic-review, opus cross-reference, sonnet structural-review) validated each candidate fix asconfirmed-drift/confirmed-safein parallel before any file was edited. All edits are purepackage.jsonkeywordsadditions; no source, test, behavioral, doc, or generator output is touched. A human will audit and promote this PR out of draft.@stdlib-js/reviewers
Generated by Claude Code