atomises spawn tables
This commit is contained in:
parent
f61af23c56
commit
aaa5376544
2 changed files with 39 additions and 12 deletions
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue