I need to generate a random number between 5 and 15. I want to do it with Math.Random()
, not using the class Random
.
I need to generate a random number between 5 and 15. I want to do it with Math.Random()
, not using the class Random
.
Use the Math.random library. To find random numbers between X and Y the formula is this:
int numero = (int)(Math.random()*(X-Y+1)+Y;