Commit 4241f8f
BUG: Prevent a panic in the case when a map only has 1 entry
When a map only has a single entry `rand.Intn()` is supplied with `0` as
as parameter which is invalid.
In addition the previous code included a `+ 1` to the result of `rand.Intn()`.
This is not needed, `rand.Intn()` provides results in the range of 0-(n-1)
which will align with the array indexes.1 parent 01b7b38 commit 4241f8f
1 file changed
+1
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
795 | 795 | | |
796 | 796 | | |
797 | 797 | | |
798 | | - | |
| 798 | + | |
799 | 799 | | |
800 | 800 | | |
801 | 801 | | |
| |||
0 commit comments