6
Since I can generate an array of random numbers with a limit, they should 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.
Substitute
int i=0
forint i=10
!– Lucio Rubens
This is not possible because "i" controls the array position and not the numbers generated from Random.
– Leonardo Rocha
True, I did. Take a look in that reply
– Lucio Rubens