with 4 buckets rand.Intn(4) will then yield 0,1,2,3 as it is, it will only yield 0,1,2 so last bucket can never be selected. I know the go documentation says it returns 0 to n, but in the current version 1.7 it will never return n. This can easily be demonstrated with:
for {
fmt.Println("1",rand.Intn(1)) // always zero never one
fmt.Println("2",rand.Intn(2)) // always zero or one
fmt
}
bucket.go, line 41 should be corrected to:
i := rand.Intn(len(b)) // - 1)
with 4 buckets rand.Intn(4) will then yield 0,1,2,3 as it is, it will only yield 0,1,2 so last bucket can never be selected. I know the go documentation says it returns 0 to n, but in the current version 1.7 it will never return n. This can easily be demonstrated with:
https://play.golang.org/p/heTsvQLLbc