From 77a797089a2e065cc8cf2a83ae8356b16591aebe Mon Sep 17 00:00:00 2001 From: bculkin2442 Date: Sun, 21 Feb 2016 15:40:30 -0500 Subject: Revamping of the way dice work --- BJC-Utils2/src/main/java/bjc/utils/dice/Die.java | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'BJC-Utils2/src/main/java/bjc/utils/dice/Die.java') diff --git a/BJC-Utils2/src/main/java/bjc/utils/dice/Die.java b/BJC-Utils2/src/main/java/bjc/utils/dice/Die.java index 9998ae7..dc512b4 100644 --- a/BJC-Utils2/src/main/java/bjc/utils/dice/Die.java +++ b/BJC-Utils2/src/main/java/bjc/utils/dice/Die.java @@ -2,15 +2,34 @@ package bjc.utils.dice; import java.util.Random; -public class Die { +/** + * A single polyhedral dice + * @author ben + * + */ +public class Die implements IDiceExpression { + /** + * Random # gen to use for dice + */ private static Random rng = new Random(); + /** + * Number of sides this die has + */ private int nSides; + /** + * Create a die with the specified number of sides + * @param nSides The number of sides this dice has + */ public Die(int nSides) { this.nSides = nSides; } + /** + * Roll this dice once + * @return The result of rolling the dice + */ public int roll() { return rng.nextInt(nSides + 1); } -- cgit v1.2.3