So I tried to use randomInt from crypto (https://nodejs.org/api/crypto.html#cryptorandomintmin-max-callback) instead of Math.random() and to me it doesn't look random enough. I used to generate a random index for an array so I usually pass 0 and arr.length as min/max.
But a lot of times I get the same numbers. Is it because I am calling it many times in a loop?
Aucun commentaire:
Enregistrer un commentaire