jeudi 1 novembre 2018

Generate a random number in interval [0,360) which is divisible by number 15

I am wondering how to generate a number in interval of [0,360) which would be also divisible by number 15. Examples: 0, 15, 30, 45, 50.. I can generate a number in the interval with:

    (int)(Math.random()*360));

But I don't know how to make sure that the generated number is divisible by number 15.




Aucun commentaire:

Enregistrer un commentaire