Skip to content

Docs: explain weightedPick distribution - #7366

Open
ICOM725 wants to merge 1 commit into
phaserjs:masterfrom
ICOM725:docs/weighted-pick-distribution
Open

Docs: explain weightedPick distribution#7366
ICOM725 wants to merge 1 commit into
phaserjs:masterfrom
ICOM725:docs/weighted-pick-distribution

Conversation

@ICOM725

@ICOM725 ICOM725 commented Sep 7, 2026

Copy link
Copy Markdown

This PR

  • Updates the Documentation

Describe the changes below:

Document how RandomDataGenerator.weightedPick converts a uniform random value into an array index. Include the selection probabilities for a four-element array to show how strongly earlier entries are favored.

Fixes #7300.

Validation:

  • Checked the documented formula against weightedPick using 100,000 evenly spaced inputs and compared the resulting frequencies with the calculated probabilities.
  • node --check src/math/random-data-generator/RandomDataGenerator.js passed.
  • git diff --check passed.

No runtime code, parameter types or generated files changed.

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.

Document the distribution of Phaser.Math.RND.weightedPick inside its JSDoc

1 participant