+ 1

I want to make a node.js code that makes drawing lots.

Like a said, but i have a problem. I can write a function that chooses random number. But i dont want to choose sama number again. How can i do?

5th Dec 2019, 1:07 PM
Ne Ararsan
Ne Ararsan - avatar
1 Answer
+ 1
1. Create an array of possible outcomes -> [1, 2, 3, 4, 5] 2. Shuffle the array 3. return a number 4. remove that number 5. go to step 3. see: https://stackoverflow.com/questions/15585216/how-to-randomly-generate-numbers-without-repetition-in-javascript
5th Dec 2019, 3:10 PM
Erich Buelow
Erich Buelow - avatar