Dice.java
jmud-0.11/src/Dice.java · 264 B
From the archive jmud-0_11.tgz
Download the archive « Back to the archive contents
class Dice {
private int sides;
private int face;
Dice(int sd) {
sides = sd;
roll();
}
int roll() {
int r = Rnd.nextInt();
if (r < 0)
r = -r;
face = r % sides + 1;
return face;
}
int getFace() {
return face;
}
}