lundi 29 mars 2021

How can I display a random position of a circle but only every each 50px in javascript?

I need to print a circle in a canvas but I need it to be only every 50 numbers. For example a circle that is located in (133,249), in this case it will round to (150,250) I have this method, but it prints anywhere

function getRandomArbitrary(min, max) {
  return Math.round(Math.random() * (max - min + 1)) + min;
}



Aucun commentaire:

Enregistrer un commentaire