promptsandmore.com

Click. Tweak. Observe. Understand.

Probability & Randomness

Weighted RNG, Poisson disk sampling, and blue noise distributions

System Overview

Weighted random number generation allows selecting outcomes with different probabilities. Unlike uniform random, weighted RNG gives control over distribution. The histogram shows actual vs expected distribution, revealing bias and fairness.

Poisson disk sampling creates evenly-spaced points with guaranteed minimum distance. This prevents clustering and creates visually pleasing, blue noise distributions ideal for procedural placement.

Why Games Use This

Key Parameters

Failure Modes

Scaling Behavior

Weighted RNG is O(n) for n outcomes, but can be optimized to O(log n) with binary search on cumulative distribution. Poisson disk sampling is O(n²) naive, but spatial hashing reduces to O(n).

Memory is O(n) for storing samples and distributions. For real-time, limit history size.

Related Algorithms

Free Tools & Libraries

System-Thinking Prompts