public class Chance
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private static java.util.Random |
random
A random instance to randomize the results.
|
Constructor and Description |
---|
Chance() |
Modifier and Type | Method and Description |
---|---|
static int |
minMax(int minimum,
int maximum) |
static float |
negativePositive(float maximum) |
private static float |
negativePositive(int maximum) |
static boolean |
oneIn(int chance) |
static boolean |
percent(double chance) |
static boolean |
percent(int chance) |
static boolean |
randomBoolean() |
static float |
randomFloat() |
static int |
randomInt(int bound) |
private static java.util.Random random
public static boolean oneIn(int chance)
chance
- The x value.public static boolean percent(int chance)
chance
- The x value.public static boolean percent(double chance)
chance
- The x value where 1 = 100%.public static int minMax(int minimum, int maximum)
minimum
- The minimum possible value.maximum
- The maximum possible value.public static float negativePositive(float maximum)
maximum
- The x value.private static float negativePositive(int maximum)
maximum
- The x value.public static int randomInt(int bound)
bound
- The exclusive maximum value.public static float randomFloat()
public static boolean randomBoolean()