diff --git a/src/main/java/BattleShip/AIGridGUI.java b/src/main/java/BattleShip/AIGridGUI.java index dbefd40..5afe8d4 100644 --- a/src/main/java/BattleShip/AIGridGUI.java +++ b/src/main/java/BattleShip/AIGridGUI.java @@ -183,6 +183,13 @@ public class AIGridGUI extends JPanel { for(int i = 0; i < rows * columns; i++) { guesses[i] = i; } + Random rand = new Random(); + for(int i = 0; i < guesses.length; i++) { + int randInt = rand.nextInt(guesses.length); + int randGuess = guesses[randInt]; + guesses[randInt] = guesses[i]; + guesses[i] = randGuess; + } } } }