@Beta public class Dice extends Object implements Serializable
Constructor and Description |
---|
Dice()
Creates a new dice roller that uses a random RNG seed for an RNG that it owns.
|
Dice(long seed)
Creates a new dice roller that will use its own RNG, seeded with the given seed.
|
Dice(RNG rng)
Creates a new dice roller that uses the given RNG, which can be seeded before it's given here.
|
Dice(String seed)
Creates a new dice roller that will use its own RNG, seeded with the given seed.
|
Modifier and Type | Method and Description |
---|---|
int |
bestOf(int n,
int dice,
int sides)
Rolls the given number of dice with the given number of sides and returns
the total of the best n dice.
|
int |
bestOf(int n,
int dice,
String group)
Find the best n totals from the provided number of dice rolled according
to the roll group string.
|
int |
bestOf(int n,
List<Integer> pool)
Totals the highest n numbers in the pool.
|
List<Integer> |
independentRolls(int n,
int sides)
Get a list of the independent results of n rolls of dice with the given
number of sides.
|
int |
rollDice(int n,
int sides)
Emulate a dice roll and return the sum.
|
int |
rollGroup(String group)
Turn the string to a randomized number.
|
void |
setRandom(RNG rng)
Sets the random number generator to be used.
|
public Dice()
public Dice(RNG rng)
rng
- an RNG that can be seeded; will be shared (dice rolls will change the RNG state outside here)public Dice(long seed)
seed
- a long to use as a seed for a new RNG (can also be an int, short, or byte)public void setRandom(RNG rng)
rng
- the source of randomnesspublic int bestOf(int n, int dice, int sides)
n
- number of best dice to totaldice
- total number of dice to rollsides
- number of sides on the dicepublic int bestOf(int n, List<Integer> pool)
n
- the number of dice to be totaledpool
- the dice to pick frompublic int bestOf(int n, int dice, String group)
n
- number of roll groups to totaldice
- number of roll groups to rollgroup
- string encoded roll groupingpublic int rollDice(int n, int sides)
n
- number of dice to sumsides
- number of sides on the rollDicepublic List<Integer> independentRolls(int n, int sides)
n
- number of dice usedsides
- number of sides on each diepublic int rollGroup(String group)
group
- string encoded roll groupingCopyright © 2012–2016. All rights reserved.