I'm doing an exercise in java. I was able to generate 6 random numbers, now, sometimes the number is being repeated. Could someone help me?
Follow the code:
public class MegaSenna {
public static void main(String[] args) {
Random radom = new Random();
gerandoNumeroSorteio(radom);
}
private static void gerandoNumeroSorteio(Random radom) {
int numeroTmp;
for (int i = 0; i < 6; i++) {
numeroTmp = radom.nextInt(60 + 1);
System.out.println((i+1)+"º numero sorteado = " + numeroTmp);
}
}
}