atomises spawn tables

This commit is contained in:
Llywelwyn 2023-07-11 03:43:14 +01:00
parent f61af23c56
commit aaa5376544
2 changed files with 39 additions and 12 deletions

View file

@ -50,7 +50,7 @@ impl RandomTable {
// the roll by the weight and test the next entry.
let mut roll = rng.roll_dice(1, self.total_weight) - 1;
let mut index: usize = 0;
while roll > 0 {
while roll >= 0 {
if roll < self.entries[index].weight {
return self.entries[index].name.clone();
}