O
O
Olek Kalashnyk2020-09-07 09:48:24
JavaScript
Olek Kalashnyk, 2020-09-07 09:48:24

How to avoid coincidences when generating random numbers?

Good afternoon,
The story is as old as the world...
I'm learning JavaScript and ran into a problem while implementing a training project.
Please help me to avoid repeating the answers that are randomly generated.

Code:
https://github.com/oleksiykalashnyk/taskForJS-game...

Demo:
https://oleksiykalashnyk.github.io/taskForJS-gameF...

I would be very grateful.
Thank you
all world

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
d-sem, 2020-09-07
@oleksiykalashnyk

Generate a result set into an array, and then take a random element from it and remove it from the array.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question