mercredi 10 novembre 2021

How to make a random number appear as much times as I want

So I want a random number (picture) from a code below to appear as much time as I want. In this case I am dealing with pictures. Let' say I want to make a picture named 1.png just to be printed on screen 4 times excatly and then let's say pictures 5.png and 6.png all together to be returned 10 times (it can be 3 times 5.png, 7 times 6.png and other ways we can get to 10) and so on for other examples. How can I do it, since I have no idea at all ?

I hope I explained the right way what I want, and I hope anyone can help, thank you for your help.

function RandomImage() {
  return (Math.ceil(Math.random() * 10)).toString() + ".png";
}



Aucun commentaire:

Enregistrer un commentaire