lundi 2 janvier 2017

How to use window.crypto.getRandomValues to get random values in a specific range

We had been using Math.random to get random numbers between 4000-64000.:

Math.floor(Math.random() * 60000 + 4000);

We have to now replace this with a more cryptographically secure random number generator. After searching on this issue we have decided to go with window.crypto.getRandomValues. I am not able to figure out how to use this to get a random number between a particular range. Can someone please help out.




Aucun commentaire:

Enregistrer un commentaire