Skip to content

Instantly share code, notes, and snippets.

@solarshado
Created June 10, 2012 19:55
Show Gist options
  • Save solarshado/2907131 to your computer and use it in GitHub Desktop.
Save solarshado/2907131 to your computer and use it in GitHub Desktop.
DiceRoller
package dice;
import java.util.Random;
public abstract class Roller {
private static Random r = new Random();
public static int d4() {
return d(4);
}
public static int d6() {
return d(6);
}
public static int d8() {
return d(8);
}
public static int d20() {
return d(20);
}
public static int dPerc() {
return d(100);
}
public static int d(int sides) {
return r.nextInt(sides) + 1;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment