34 lines
663 B
Java
34 lines
663 B
Java
package Domain;
|
|
|
|
import java.util.Random;
|
|
|
|
public class Dice {
|
|
private int numberOfDice;
|
|
private int[] values;
|
|
private Random random;
|
|
|
|
public Dice(int numberOfDice){
|
|
this.numberOfDice = numberOfDice;
|
|
this.values = new int[5];
|
|
this.random = new Random();
|
|
}
|
|
|
|
public void rollDice(int numberOfDice){
|
|
for(int i = 0; i < values.length; i++){
|
|
values[i] = random.nextInt(6) + 1;
|
|
}
|
|
}
|
|
|
|
public int getAugenzahl(){
|
|
return numberOfDice;
|
|
}
|
|
|
|
public int getValue(int index){
|
|
return values[index];
|
|
}
|
|
|
|
public int[] getValues(){
|
|
return values;
|
|
}
|
|
}
|