title: How to prevent repeat statements for dice rolling
body: <p>I'm trying to figure out a way to prevent the statement printing out way too many times. </p>
  
  <p>Output is supposed to look like this: </p>
  
  <blockquote>
    <p>Enter Seed: 100</p>
    
    <p>rolls: 6 6 2</p>
    
    <p>You rolled a pair</p>
    
    <p>rolls: 6 6 1</p>
    
    <p>You rolled a pair</p>
    
    <p>You are lucky</p>
  </blockquote>
  
  <p>I'm not sure how to move around the boolean method or only call the boolean result so it doesn't print out the type of roll multiple times.</p>
  
  <pre class="lang-java prettyprint-override"><code>import java.util.Scanner;
  import java.util.Random;
  
  public class Triple {
  
      public static boolean rollType(int x, int y, int z){
  
          boolean lucky = false;
  
          if(x == y &amp;&amp; y == z){
              System.out.println("You rolled a triple");
              lucky = true;
          }
          else if(x == y || y == z || x == z){
              System.out.println("You rolled a pair");
              lucky = true;
          }
          else{
              System.out.println("You rolled nothing");
              lucky = false;
          }
  
          return lucky;
      }
  
      public static void main (String[] args) {
  
         Scanner scnr = new Scanner(System.in);  
         Random randGen = new Random();  // New random number generator
         int seedVal = 0;
         final int MAX_DICE = 8;
  
          //User input
         System.out.println("Enter Seed: ");
         seedVal = scnr.nextInt();
         randGen.setSeed(seedVal);
  
         int a1 = (randGen.nextInt(MAX_DICE)+1);
         int b1 = (randGen.nextInt(MAX_DICE)+1);
         int c1 = (randGen.nextInt(MAX_DICE)+1);
  
         int a2 = (randGen.nextInt(MAX_DICE)+1);
         int b2 = (randGen.nextInt(MAX_DICE)+1);
         int c2 = (randGen.nextInt(MAX_DICE)+1);
  
          // randGen.nextInt(MAX_DICE) yields 0, 1, 2, 3, 4, 5, or 7
          // so + 1 makes that 1, 2, 3, 4, 5, 6, 7, or 8
          System.out.println("rolls: " + a1 + " " + b1 + " " + c1);
          rollType(a1, b1, c1);
          System.out.println("rolls: " + a2 + " " + b2 + " " + c2);
          rollType(a2, b2, c2);
  
          if (rollType(a1, b1, c1) &amp;&amp; rollType(a2, b2, c2)){  //work on how to fix it from printing twice THEN the boolean. should only print boolean.
              System.out.println("You are lucky");
          }
          else{
              System.out.println("You are NOT lucky");
          }
  
          return;
     }
  }
  </code></pre>