Random number between 5 and 15 Java

-3

I need to generate a random number between 5 and 15. I want to do it with Math.Random() , not using the class Random .

    
asked by Sergio AG 09.06.2018 в 03:33
source

1 answer

0

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;
    
answered by 09.06.2018 в 15:43