dimanche 26 février 2017

How to make a function run a number of times that is randomly generated

I am making a game in which there will be a random number generated, and I want that many random numbers generated. So for example if the number is 6 i want 6 more random numbers to be generated. So is there a way to run a function containing this (and a few other things) X numebr of times?

Just a code example:

let circNum = Math.floor( Math.random() * 4 + 3 )
let circles = function() {
  //generate circNum random numbers
  //make circNum new divs
}




Aucun commentaire:

Enregistrer un commentaire