From f8cb7ef6fa10d142ce1bf7d0a4ca218803ccc36f Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Tue, 1 Oct 2019 18:45:36 +1000 Subject: [PATCH] Call rand.Shuffle instead of rand.Perm --- connection.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/connection.go b/connection.go index 289d20a8..6664e01a 100644 --- a/connection.go +++ b/connection.go @@ -944,8 +944,9 @@ func (c *connection) requestPendingMetadata() { pending = append(pending, index) } } - for _, i := range rand.Perm(len(pending)) { - c.requestMetadataPiece(pending[i]) + rand.Shuffle(len(pending), func(i, j int) { pending[i], pending[j] = pending[j], pending[i] }) + for _, i := range pending { + c.requestMetadataPiece(i) } } -- 2.48.1