// Project: Loops // Module: dice1 // Source code file: Main.java // Print NUM_ROLLS rolls of two fair dice; // rand.nextInt(6) returns a random int in // the interval [0,6) (0 inclusive, 6 exclusive). import java.util.Random; public class Main { // Define constant for number of rolls. public final static int NUM_ROLLS = 10; public static void main(String[] args) { // Create Random object. Random rand = new Random( ); // Generat and print dice rolls. for(int n = 1; n <= NUM_ROLLS; n++) { int roll1 = rand.nextInt(6) + 1; int roll2 = rand.nextInt(6) + 1; System.out.println(roll1 + " " + roll2); } } }