Skip to content

Commit

Permalink
Merge pull request #116 from ipfs/uci/copy-templates
Browse files Browse the repository at this point in the history
ci: uci/copy-templates
  • Loading branch information
galargh authored Aug 15, 2023
2 parents bc50d2e + a05881d commit 8cdf2cb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions flatfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,12 @@ var (
ErrInvalidKey = errors.New("key not supported by flatfs")
)

var (
r *rand.Rand
)

func init() {
rand.Seed(time.Now().UTC().UnixNano())
r = rand.New(rand.NewSource(time.Now().UTC().UnixNano()))
}

// Datastore implements the go-datastore Interface.
Expand Down Expand Up @@ -866,7 +870,7 @@ func folderSize(path string, deadline time.Time) (int64, initAccuracy, error) {
// randomize file order
// https://stackoverflow.com/a/42776696
for i := len(files) - 1; i > 0; i-- {
j := rand.Intn(i + 1)
j := r.Intn(i + 1)
files[i], files[j] = files[j], files[i]
}

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ require (
go.uber.org/zap v1.10.0 // indirect
)

go 1.19
go 1.20

0 comments on commit 8cdf2cb

Please sign in to comment.