vendredi 17 août 2018

Best approach to random 10 numbers between 1 and 100 no dupes in javascript?

This has been asked dozens of times, but somehow, after reading many answers, I'm not convinced.

  1. Should I set the list [1.. 100] and keep picking random (it will run 10 times) from there to another array, avoiding searching for it every new random?

  2. Should I develop and run 10 times (at least) a random function to return a 1.. 100, checking if it is not a dupe and put it into an array?

  3. Some javascript function that I'm missing?

Thanks




Aucun commentaire:

Enregistrer un commentaire