|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectthings.common.tools.Gamer
public class Gamer
A general odds tool.
Version History
EPG - Rewrite - 10 AUG 06
Field Summary | |
---|---|
java.util.Random |
rng
The Random source. |
Constructor Summary | |
---|---|
Gamer()
Construct the gamer. |
Method Summary | |
---|---|
boolean |
flipcoin()
Flip a coin, true or false. |
boolean |
percent(int chance)
A percentage chance. |
java.lang.String |
pick(java.lang.String[] strings)
Pick one. |
int |
pickNumber(int[] numbers)
Pick one. |
int |
range(int lowest,
int highest)
A range. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public java.util.Random rng
Constructor Detail |
---|
public Gamer()
Method Detail |
---|
public boolean flipcoin()
public boolean percent(int chance)
chance
- the percentage change. 0 is never, 100 is always, and all chances in between. other numbers will always yeild a lose (false).
public int range(int lowest, int highest)
lowest
- lowest number, inclusivehighest
- highest number, inclusive.
public java.lang.String pick(java.lang.String[] strings)
strings
- an array of Strings.
public int pickNumber(int[] numbers)
numbers
- an array of int.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |