⚡ Bolt: Optimize unique random number generation in random.html#96
⚡ Bolt: Optimize unique random number generation in random.html#96babelman97 wants to merge 1 commit into
Conversation
- Implement hybrid algorithm: Rejection sampling for low density and Sparse Fisher-Yates shuffle for high density. - Fix O(N^2+) performance collapse (Coupon Collector's Problem) for high-density requests. - Logic speedup: ~10x improvement for 1,000,000 numbers (2251ms -> 216ms). - Switch to textContent for faster DOM updates and safer string handling. - Improve UX with scrollable, word-wrapped results container and better page scrolling. - Fix validation bug to allow single-value ranges. Co-authored-by: babelman97 <[email protected]>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
Optimized the
random.htmlunique random number generator by implementing a hybrid algorithm (Rejection Sampling + Sparse Fisher-Yates Shuffle). This addresses a significant performance bottleneck where generating a large number of unique values in a small range caused excessive collisions and UI freezes.Key Improvements:
max-height,overflow-y, andoverflow-wrapto prevent layout thrashing and ensure the page remains usable during large generations.innerTextwithtextContentand added clear documentation for the optimization.PR created automatically by Jules for task 13581374728816711889 started by @babelman97