Simplify random.Int64 usage with generics

This commit is contained in:
Deluan
2024-05-11 20:10:46 -04:00
parent 0ae2944073
commit 3463d0c208
4 changed files with 7 additions and 5 deletions
+1 -1
View File
@@ -39,7 +39,7 @@ func (w *WeightedChooser) weightedChoice() (int, error) {
if w.totalWeight == 0 {
return 0, errors.New("no choices available")
}
rnd := Int64(int64(w.totalWeight))
rnd := Int64(w.totalWeight)
for i, weight := range w.weights {
rnd -= int64(weight)
if rnd < 0 {