Skip to content

refactor: align stream constructor parameter names with documentation in random/streams#12624

Draft
Planeshifter wants to merge 1 commit into
developfrom
philipp/random-streams-signature-param-names
Draft

refactor: align stream constructor parameter names with documentation in random/streams#12624
Planeshifter wants to merge 1 commit into
developfrom
philipp/random-streams-signature-param-names

Conversation

@Planeshifter
Copy link
Copy Markdown
Member

Description

What is the purpose of this pull request?

This pull request aligns the distribution parameter name in five random/streams declaration files with their own @param/@throws TSDoc and the underlying implementation. The RandomStream constructor, callable/newable, factory, and objectMode signatures named the parameter p (or k for the Student's t distribution), which did not match the documented/implemented name:

Package Signature param Documented & impl name
streams/exponential p lambda (rate parameter)
streams/poisson p lambda (mean)
streams/rayleigh p sigma (scale parameter)
streams/chisquare p k (degrees of freedom)
streams/t k v (degrees of freedom)

Each rename touches the six signature occurrences per package (constructor, new, callable, factory, the options-only factory return, and objectMode). Verified against each package's lib/main.js (function RandomStream( lambda, ... ), etc.) and its TSDoc @param/@throws tags.

Parameter names in ambient declarations are documentation only and do not affect type-checking, so this is a non-behavioral refactor; no $ExpectType/$ExpectError assertions are affected.

Related Issues

Does this pull request have any related issues?

No.

Questions

Any questions for reviewers of this pull request?

No.

Other

Any other information relevant to this pull request? This may include screenshots, references, and/or implementation notes.

Part of a TypeScript-declaration audit of the @stdlib/random namespace, batched into a single PR at the maintainer's request. (The streams/t _sek_sep private-member fix is handled in a separate type PR.)

Checklist

Please ensure the following tasks are completed before submitting this pull request.

AI Assistance

When authoring the changes proposed in this PR, did you use any kind of AI assistance?

  • Yes
  • No

If you answered "yes" above, how did you use AI assistance?

  • Code generation (e.g., when writing an implementation or fixing a bug)
  • Test/benchmark generation
  • Documentation (including examples)
  • Research and understanding

Disclosure

A TypeScript-declaration audit surfaced these inconsistencies using Claude Code; each rename target was independently verified against the implementation and TSDoc, and the changes were reviewed by myself before submitting.


@stdlib-js/reviewers

… in random/streams

The `RandomStream` constructor, callable/newable, `factory`, and
`objectMode` signatures named their distribution parameter `p` (or `k`
for the Student's t distribution), diverging from the `@param`/`@throws`
TSDoc and the implementation, which use the distribution-appropriate
names:

- exponential: `p` -> `lambda` (rate parameter)
- poisson:     `p` -> `lambda` (mean)
- rayleigh:    `p` -> `sigma` (scale parameter)
- chisquare:   `p` -> `k` (degrees of freedom)
- t:           `k` -> `v` (degrees of freedom)

Parameter names in ambient declarations are documentation only and do
not affect type-checking, so this is a non-behavioral refactor that
makes the signatures self-consistent with their TSDoc and the runtime
implementation.
@stdlib-bot
Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
random/streams/chisquare $\color{green}812/812$
$\color{green}+100.00\%$
$\color{green}92/92$
$\color{green}+100.00\%$
$\color{green}15/15$
$\color{green}+100.00\%$
$\color{green}812/812$
$\color{green}+100.00\%$
random/streams/exponential $\color{green}812/812$
$\color{green}+100.00\%$
$\color{green}92/92$
$\color{green}+100.00\%$
$\color{green}15/15$
$\color{green}+100.00\%$
$\color{green}812/812$
$\color{green}+100.00\%$
random/streams/poisson $\color{green}812/812$
$\color{green}+100.00\%$
$\color{green}92/92$
$\color{green}+100.00\%$
$\color{green}15/15$
$\color{green}+100.00\%$
$\color{green}812/812$
$\color{green}+100.00\%$
random/streams/rayleigh $\color{green}812/812$
$\color{green}+100.00\%$
$\color{green}92/92$
$\color{green}+100.00\%$
$\color{green}15/15$
$\color{green}+100.00\%$
$\color{green}812/812$
$\color{green}+100.00\%$
random/streams/t $\color{green}812/812$
$\color{green}+100.00\%$
$\color{green}92/92$
$\color{green}+100.00\%$
$\color{green}15/15$
$\color{green}+100.00\%$
$\color{green}812/812$
$\color{green}+100.00\%$

The above coverage report was generated for the changes in this PR.

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.

2 participants