Miscellany
public text v1 · immutableimport java.util.Random;
public class Die {
private int value;
//constructor
public Die(){
value = 0; //initialize the value.
}
//get a random value
public void roll(){
Random generator = new Random();
value = generator.nextInt(6) + 1;
}
//return the resultant.
public int getValue()
{
return value;
}
}