+ 1
Random Number Generation Repeating
while (true) { cpuLetterGuess = (int) (Math.random() * 10); cpuNumGuess = (int) (Math.random() * 10); if (!(cpuGuesses.contains((char)(cpuLetterGuess + 65) + " " + cpuNumGuess))) { cpuGuesses += "" + ((char) (cpuLetterGuess + 65)) + cpuNumGuess ; System.out.print(cpuGuesses); break; } } Hey all, so I'm tryna prevent the computer from selecting the same coordinates twice from my array. This is my code so far but the randomiser still repeats. Why is that? Thanks for the help guys :)
1 Odpowiedź