I am doing something where I have to choose a couple random numbers, without choosing the same number again. I have tried many ways, but they will not work. I checked if the random number exists in my int[], and reset the int to another random, but what is that other random also exists, I tried fixing that but I ran into problems.
Here's my current code:
p.sendMessage("debug over max");
Random r = new Random();
for (int i=0;i<max + 1;i++) {
int ran = r.nextInt(arenaAmount);
if (ran == 0) ran = 1;
arenas[i] = ran;
}
Thats what I have so far, so how can I make sure it doesn't have the same number. If there is another thread already please link me to it.
Thanks, Joey.