diff --git a/.jules/bolt.md b/.jules/bolt.md new file mode 100644 index 0000000..586f922 --- /dev/null +++ b/.jules/bolt.md @@ -0,0 +1,3 @@ +## 2025-05-15 - Hybrid Sampling for Unique Random Numbers +**Learning:** Rejection sampling using a `Set` for unique random numbers suffers from the 'Coupon Collector's Problem' as the requested count approaches the total range size. This causes a catastrophic performance collapse (exponential increase in collisions). +**Action:** Implement hybrid sampling. Switch from rejection sampling to exclusion-based sampling (generate a set of numbers to skip) when the requested count exceeds 50% of the total range. Follow with a Fisher-Yates shuffle to preserve random order. This avoids the collision bottleneck while maintaining O(N) complexity. diff --git a/random.html b/random.html index 2609ac8..9e41e24 100644 --- a/random.html +++ b/random.html @@ -49,22 +49,50 @@