Call rand.Shuffle instead of rand.Perm

This commit is contained in:
Matt Joiner 2019-10-01 18:45:36 +10:00
parent 5b0c895e09
commit f8cb7ef6fa
1 changed files with 3 additions and 2 deletions

View File

@ -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)
}
}