diff --git a/.jules/bolt.md b/.jules/bolt.md new file mode 100644 index 0000000..60ae5b8 --- /dev/null +++ b/.jules/bolt.md @@ -0,0 +1,3 @@ +## 2025-05-15 - [Random unique sampling density optimization] +**Learning:** Rejection sampling (Set) for unique random numbers collapses at high density (Coupon Collector's Problem). Hybrid approaches using Fisher-Yates shuffle for high density (count > 50% of range) ensure O(N) complexity. Also, strict range validation (minValue >= maxValue) prevents single-value generation which is sometimes desired. +**Action:** Always check sampling density for unique random generation and use hybrid strategies. Ensure range validation allows single values (minValue === maxValue) if requested count is 1. diff --git a/random.html b/random.html index 2609ac8..4b7afaa 100644 --- a/random.html +++ b/random.html @@ -10,9 +10,11 @@ flex-direction: column; align-items: center; justify-content: center; - height: 100vh; + min-height: 100vh; background-color: #f0f0f0; font-family: Arial, sans-serif; + padding: 20px; + box-sizing: border-box; } .button { padding: 20px 40px; @@ -23,11 +25,23 @@ background-color: #4CAF50; color: white; border-radius: 10px; + transition: background-color 0.3s; + } + .button:hover { + background-color: #45a049; } .number { - font-size: 36px; + font-size: 1.2rem; color: #333; - margin-top: 10px; + margin-top: 20px; + max-width: 800px; + max-height: 50vh; + overflow-y: auto; + word-break: break-all; + background: white; + padding: 15px; + border-radius: 10px; + box-shadow: 0 2px 5px rgba(0,0,0,0.1); } .input-field { margin: 10px 0; @@ -49,22 +63,51 @@