How can I generate an array of random numbers with a limit, must be numbers from 10 to 50.
To generate random numbers from 0 to 50 I use:
Random random = new Random();
int array[] = new int[5]; // 5 números serão gerados.
for (int i=0; i<array.length; i++) {
array[i] = random.nextInt(50); // Gera números aleatórios com limite 50.
System.out.println(array[i]); // Saída, são gerados 5 números.
}
I would like to generate numbers from 10 up to a maximum of 50. instead of starting at 0.