/** * Round.java * * * Created: Thu Sep 28 08:30:00 2000 * * @author David Green * @version */ public class Round { public static void main(String[] args) { int goodValue; // dice roll int goodCounts[] = new int[7]; // stats (0th item not used) int badValue; // dice roll int badCounts[] = new int[7]; // stats int i; // loop index final int MAX = 30000; // number to do for ( i = 0; i < MAX; i++ ) { goodValue = 1 + (int) (Math.random() * 6.); goodCounts[goodValue]++; badValue = (int) Math.round( 1. + Math.random() * 5. ); badCounts[badValue]++; } for ( i = 1; i < 7; i++ ) { System.out.println("goodCounts[" + i + "] = " + goodCounts[i]); } System.out.println( "" ); // blank line for ( i = 1; i < 7; i++ ) { System.out.println("badCounts[" + i + "] = " + badCounts[i]); } } } // Round