title: Resetting a game to start over in java
body: <p>I created a dice game between the user and computer that loops 10 rounds - but if one of the game rounds is a tie - then it will ask if you want to play again and restart the game. I'm having a problem with the last part as the game iterates over at random times now. Any suggestions?</p>
  
  <pre><code>import java.util.Random;
  import java.util.Scanner;
  public class Lab2 {
  public static void main(String[] args) {
      Scanner in = new Scanner(System.in);
      System.out.println("User vs. Computer Dice Game");
  
      boolean Correct = false;
      boolean Replay = false;
  
      while(Replay == true) {
  
      }
      while(Correct == false) {
  
          System.out.println("Do you want to play again? ");
          String a = in.nextLine();
          System.out.print(a);
          if (a.equals("yes")) {
              for(int i =1; i&lt;11; i++) {
  
                  Random rand = new Random();
                  int usernum = rand.nextInt(6)+1;
                  System.out.println("User rolled: "+usernum);
                  Random rand2 = new Random();
                  int computernum = rand2.nextInt(6)+1;
                  System.out.println("Computer rolled: "+computernum);
  
                  if (usernum &gt; computernum) {
                      System.out.println("User wins");
                      System.out.println();
                  }if (computernum &gt; usernum) {
                      System.out.println("Computer wins");
                      System.out.println();
                  }
                  if(usernum == computernum) {
                      System.out.println("It\'s a tie!");
                      System.out.println("Do you want to play again? (Y/N) ");
                      System.out.println();
                      if (a.equalsIgnoreCase("N")){
                          Replay = true;
                      }
                      else {
                          Correct = false;
                      }
                  } 
              } 
          }
          System.out.println();
          }
      }
  }
  </code></pre>