From 1bff7e49ed64d74e36d901e84c594cf63b58350b Mon Sep 17 00:00:00 2001 From: bculkin2442 Date: Fri, 18 Mar 2016 19:47:49 -0400 Subject: General changes to the dice package The biggest change is the addition of variables and assignment --- BJC-Utils2/src/main/java/bjc/utils/dice/Die.java | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (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 dc512b4..9fdac14 100644 --- a/BJC-Utils2/src/main/java/bjc/utils/dice/Die.java +++ b/BJC-Utils2/src/main/java/bjc/utils/dice/Die.java @@ -4,6 +4,7 @@ import java.util.Random; /** * A single polyhedral dice + * * @author ben * */ @@ -11,26 +12,34 @@ public class Die implements IDiceExpression { /** * Random # gen to use for dice */ - private static Random rng = new Random(); - + private static Random rng = new Random(); + /** * Number of sides this die has */ - private int nSides; - + private int nSides; + /** * Create a die with the specified number of sides - * @param nSides The number of sides this dice has + * + * @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); } + + @Override + public String toString() { + return "d" + nSides; + } } -- cgit v1.2.3