From f9e1fa26ff4e182e0a5ae1b23f2cfcba6a6b0ca9 Mon Sep 17 00:00:00 2001 From: Max Stabel Date: Tue, 5 Jan 2021 16:36:41 +0100 Subject: [PATCH] Fix missing rand seed for restic check --read-data-subset=x% --- cmd/restic/cmd_check.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cmd/restic/cmd_check.go b/cmd/restic/cmd_check.go index c1a6e5464..859e16580 100644 --- a/cmd/restic/cmd_check.go +++ b/cmd/restic/cmd_check.go @@ -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 {