diff --git a/.jules/bolt.md b/.jules/bolt.md new file mode 100644 index 0000000..236f167 --- /dev/null +++ b/.jules/bolt.md @@ -0,0 +1,3 @@ +## 2025-06-24 - [Random Number Generation Optimization] +**Learning:** Rejection sampling for unique random numbers (using a Set) collapses at high densities (count > 50% of range) due to the Coupon Collector's Problem, leading to O(N²+) complexity. A Sparse Fisher-Yates shuffle using a Map provides guaranteed O(count) time and space complexity even at 100% density. +**Action:** Use a hybrid approach: rejection sampling for low density (< 50%) and Sparse Fisher-Yates for high density (>= 50%). Switch to `textContent` for bulk DOM updates and add CSS `overflow-y` / `word-break` to prevent UI lockup when rendering massive result sets. diff --git a/random.html b/random.html index 2609ac8..a0ec0ab 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,48 +25,123 @@ background-color: #4CAF50; color: white; border-radius: 10px; + transition: background-color 0.3s; + } + .button:hover { + background-color: #45a049; } .number { - font-size: 36px; + font-size: 18px; color: #333; - margin-top: 10px; + margin-top: 20px; + max-height: 400px; + overflow-y: auto; + word-break: break-all; + background: white; + padding: 15px; + border-radius: 8px; + box-shadow: 0 2px 5px rgba(0,0,0,0.1); + width: 100%; + max-width: 600px; + text-align: center; + display: none; } .input-field { margin: 10px 0; font-size: 18px; padding: 10px; - width: 80px; + width: 100px; text-align: center; border: 1px solid #ccc; border-radius: 5px; } + .input-container { + background: white; + padding: 20px; + border-radius: 12px; + box-shadow: 0 4px 6px rgba(0,0,0,0.05); + margin-bottom: 20px; + } + .label { + display: inline-block; + width: 100px; + font-weight: bold; + }
-