Web Tools Table Maker3schools TranslateImage CompressorFavicon Icon GeneratorCrop & Resize Image
Apu
Apu June 03, 2023 › #Array #for-loop

How to generate random numbers without repetition in javascript

After reading this article, you will able to generate random numbers without repetition using JavaScript.

Suppose, you want to create a quiz app where the questions will display randomly. But, there is a problem. Whenever, the quiz displays the questions and answers randomly, one question can display multiple times. So, we need to remove the duplicate questions and display the unique questions.

Generate random number without repetition
Try it Yourself »

In the above example, first of all, I have created a button with a function named generateRandomQuestion. Whenever, someone clicks on that button the function generateRandomQuestion will execute.

save
listen
AI Answer
Write Your Answer
loading
back
View All