samedi 3 juillet 2021

Math.random() generates same number Javascript [closed]

I am trying to make a random number generator in JS and I cannot generate one. All the time it returns the same number 2 or 0 (If I change the number) here's the code:

function nextSequence() {
  var randomNumber = Math.floor(Math.random() * 4);
  console.log(randomNumber);
}

nextSequence();
nextSequence();
nextSequence();
nextSequence();
nextSequence();
nextSequence();
nextSequence();
nextSequence();



Aucun commentaire:

Enregistrer un commentaire