Created
June 10, 2012 19:55
-
-
Save solarshado/2907131 to your computer and use it in GitHub Desktop.
DiceRoller
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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