2
2
mirror of https://github.com/octoleo/restic.git synced 2024-11-26 06:46:34 +00:00

Merge pull request #3217 from M4a1x/read-data-subset-fix

Fix missing rand seed for restic check --read-data-subset=x%
This commit is contained in:
MichaelEischer 2021-01-29 23:34:13 +01:00 committed by GitHub
commit 4d576c2f79
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5,6 +5,7 @@ import (
"math/rand"
"strconv"
"strings"
"time"
"github.com/spf13/cobra"
@ -333,7 +334,9 @@ func selectRandomPacksByPercentage(allPacks map[restic.ID]int64, percentage floa
if packsToCheck < 1 {
packsToCheck = 1
}
idx := rand.Perm(packCount)
timeNs := time.Now().UnixNano()
r := rand.New(rand.NewSource(timeNs))
idx := r.Perm(packCount)
var keys []restic.ID
for k := range allPacks {