Chance.WeightedEntry
| Type | 🔵 Class |
| Package | io.github.mrtesz.teszcore.util |
| GitHub | Chance.java |
| Extends | Pair<Double, T> |
Description
Util class for chance and value, used in Chance#roll.
Chances do not need to sum to
1.0— entries are rolled relative to each other. e.g.0.5, 0.3, 0.2and5, 3, 2produce the same distribution.
Constructor
WeightedEntry(double chance, T value);
| Parameter | Type | Annotations | Description | |:———:|:——–:|:———–:|————-| | chance | double | - | Chance | | value | T | - | Value | —
Methods
getChance
double getChance();
Get the chance
Returns: double — chance
getValue
T getValue();
Get the value
Returns: T — value