diff --git a/direct/src/directutil/WeightedChoice.py b/direct/src/directutil/WeightedChoice.py index 134f609a59..3038a32947 100755 --- a/direct/src/directutil/WeightedChoice.py +++ b/direct/src/directutil/WeightedChoice.py @@ -10,8 +10,8 @@ class WeightedChoice: self.listOfLists = listOfLists self.weightIndex = weightIndex - def choose(self): - roll = random.randrange(self.total) + def choose(self, rng=random): + roll = rng.randrange(self.total) weight = self.weightIndex for i in self.listOfLists: roll -= i[weight]