dimanche 7 août 2022

Actual random numbers in JS

I'm probably missing something here, and I'd like to know what, but it seems to me that generating unique numbers in JS is about the easiest thing in the world. Honestly I expect to get punked hard on this, but doesn't this generate an irrefutably unique number (of reasonable length)?

function getRandom() {

      let     date = new Date(),
              time = date.getTime();

      

      console.log(time * Math.random());
}



Aucun commentaire:

Enregistrer un commentaire