title: Rolling two dice and returning count
body: <p>I'm writing a java program to simulate rolling of two dices. For each roll, if both dice does not have the same face, i increment a counter. Until when both dice have the same face, i want to print out the counter value. Count is basically counting how many times it took to achieve the same faces on both dices.</p>
  
  <p>I tried writing:</p>
  
  <pre><code>int count = 0;
  
  while (true) {
      int dice1 = getRandom(1,6);
      int dice2 = getRandom(1,6);
  
      if (dice1 != dice2) {
          count ++;
      }
  System.out.println(count);
  </code></pre>
  
  <p>The code doesn't seem to produce the correct output. I'm curious if I'm simulating it correctly based on my logic? I'm new to java and would appreciate some help on this. </p>
  
  <p>The getRandom() function returns a random number between 1 and 6 since a dice can have 1 to 6 values.</p>
  
  <pre><code>private static int getRandom(int n1, int n2){
      int retVal = 0;
  
      retVal = n1 + (int) Math.floor(Math.random() * (n2 - n1 + 1));
  
      return retVal;
  }
  </code></pre>