diff --git a/zk/util.go b/zk/util.go index 769bbe87..12ef93c4 100644 --- a/zk/util.go +++ b/zk/util.go @@ -5,6 +5,7 @@ import ( "encoding/base64" "fmt" "math/rand" + "time" "strconv" "strings" ) @@ -47,8 +48,9 @@ func FormatServers(servers []string) []string { // stringShuffle performs a Fisher-Yates shuffle on a slice of strings func stringShuffle(s []string) { + r := rand.New(rand.NewSource(time.Now().UnixNano())) for i := len(s) - 1; i > 0; i-- { - j := rand.Intn(i + 1) + j := r.Intn(i + 1) s[i], s[j] = s[j], s[i] } }