Generating Unique Random Numbers in JavaScript Using Sets

Want to create more randomized effects in your JavaScript code? The Math.random() method alone, with its limitations, won’t cut it for generating unique random numbers. Amejimaobari Ollornwi explains how to generate a series of unique random numbers using the Set object, how to use these random numbers as indexes for arrays, and explores some practical applications of randomization. https://smashingmagazine.com/2024/08/generating-unique-random-numbers-javascript-using-sets/

Vytvorené 10mo | 26. 8. 2024, 16:30:14


Ak chcete pridať komentár, prihláste sa

Ostatné príspevky v tejto skupine

CSS Intelligence: Speculating On The Future Of A Smarter Language

CSS has evolved from a purely presentational language into one with growing logical powers — thanks to features like container queries, relational pseudo-classes, and the if() function. Is it still

2. 7. 2025, 13:50:02 | Smashing magazine
Turning User Research Into Real Organizational Change

Bridging the gap between user research insights and actual organizational action — with a clear roadmap for impact. https://smashingmagazine.com/2025/07/turning-user-research-into-organizational-chang

1. 7. 2025, 12:20:10 | Smashing magazine
Never Stop Exploring (July 2025 Wallpapers Edition)

July is just around the corner, and that means it’s time for a new collection of desktop wallpapers. Created with love by artists and designers from across the globe, they are bound to bring some good

30. 6. 2025, 13:10:08 | Smashing magazine
Can Good UX Protect Older Users From Digital Scams?

As online scams become more sophisticated, Carrie Webster explores whether good UX can serve as a frontline defense, particularly for non-tech-savvy older users navigating today’s digital world. https

25. 6. 2025, 15:10:05 | Smashing magazine
Decoding The SVG <code>path</code> Element: Curve And Arc Commands

On her quest to teach you how to code vectors by hand, Myriam Frisano’s second installment of a path deep dive explores the most complex aspects of SVG’s most powerful element. She’ll help you under

23. 6. 2025, 12:10:03 | Smashing magazine
CSS Cascade Layers Vs. BEM Vs. Utility Classes: Specificity Control

CSS can be unpredictable — and specificity is often the culprit. Victor Ayomipo breaks down how and why your styles might not behave as expected, and why understanding specificity is better than relyi

19. 6. 2025, 15:20:07 | Smashing magazine
Meet Accessible UX Research, A Brand-New Smashing Book

Meet “Accessible UX Research,” our upcoming book to make your UX research inclusive. Learn how to recruit, plan, and design with disabled participants in mind. Print shipping in August 2025. e

18. 6. 2025, 18:30:03 | Smashing magazine