1 package chance; 2 3 public class Die { 4 5 private int order; 6 private int top; 7 8 public Die() { 9 order = 6; 10 top = (int) ( ( Math.random() * 6) + 1); 11 } 12 13 public Die(int nrOfSides) { 14 order = nrOfSides; 15 top = (int) ((Math.random() * order) + 1 ); 16 } 17 18 public int top() { 19 return top; 20 } 21 22 public void roll() { 23 top = (int) ((Math.random() * order) + 1 ); 24 } 25 } 26