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