diff options
| author | bculkin2442 <bjculkin@mix.wvu.edu> | 2016-03-18 19:47:49 -0400 |
|---|---|---|
| committer | bculkin2442 <bjculkin@mix.wvu.edu> | 2016-03-18 19:50:05 -0400 |
| commit | 1bff7e49ed64d74e36d901e84c594cf63b58350b (patch) | |
| tree | 234ee635d36a5a4a26994e07ac2367f87b0cba3a /BJC-Utils2/src/main/java/bjc/utils/dice/Die.java | |
| parent | 8ffe41a3575e7d9e4602deeb5f878c4687f4e389 (diff) | |
General changes to the dice package
The biggest change is the addition of variables and assignment
Diffstat (limited to 'BJC-Utils2/src/main/java/bjc/utils/dice/Die.java')
| -rw-r--r-- | BJC-Utils2/src/main/java/bjc/utils/dice/Die.java | 21 |
1 files changed, 15 insertions, 6 deletions
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; + } } |
