Package net.sf.colossus.util
Class Probs
java.lang.Object
net.sf.colossus.util.Probs
Class Probs holds utility methods for working with probabilities.
- Author:
- David Ripton
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic int
choose
(int a, int b) Compute a choose b.static int
factorial
(int n) Compute n!static double
meanHits
(int dice, int strikeNumber) Return the unrounded mean number of hits.static int
modeHits
(int dice, int strikeNumber) Return the most likely number of hits.static double
probHits
(int dice, int strikeNumber, int hits) Return the probability of getting exactly this number of hits.static double
probHitsOrLess
(int dice, int strikeNumber, int hits) Return the probability of getting this number of hits or less.static double
probHitsOrMore
(int dice, int strikeNumber, int hits) Return the probability of getting this number of hits or more.static int
Return the next die roll in a predictable regular sequence, useful for estimating combat results.
-
Field Details
-
LOGGER
-
lastFakeDie
static int lastFakeDie
-
-
Constructor Details
-
Probs
public Probs()
-
-
Method Details
-
factorial
public static int factorial(int n) Compute n! -
choose
public static int choose(int a, int b) Compute a choose b. -
probHits
public static double probHits(int dice, int strikeNumber, int hits) Return the probability of getting exactly this number of hits. -
probHitsOrMore
public static double probHitsOrMore(int dice, int strikeNumber, int hits) Return the probability of getting this number of hits or more. -
probHitsOrLess
public static double probHitsOrLess(int dice, int strikeNumber, int hits) Return the probability of getting this number of hits or less. -
meanHits
public static double meanHits(int dice, int strikeNumber) Return the unrounded mean number of hits. -
modeHits
public static int modeHits(int dice, int strikeNumber) Return the most likely number of hits. If there are two modes, return the higher one. -
rollFakeDie
public static int rollFakeDie()Return the next die roll in a predictable regular sequence, useful for estimating combat results. The current sequence is 436125.
-