Skip to content

Commit

Permalink
Merge pull request #1436 from vmware/fix/replace-deprecated-rand.Seed
Browse files Browse the repository at this point in the history
fix: replace deprecated `rand.Seed`
  • Loading branch information
ksamoray authored Jan 14, 2025
2 parents 60ee4fb + 0067b8d commit 22f8578
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions nsxt/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,17 @@ const doubleTags string = `
tag = "tag2"
}`

var randomized = false
var letterRunes = []rune("abcdefghijklmnopqrstuvwxyz")
var (
randomized bool
letterRunes = []rune("abcdefghijklmnopqrstuvwxyz")
rnd *rand.Rand
)

func initRand() {
if randomized {
return
}
rand.Seed(time.Now().UnixNano())
rnd = rand.New(rand.NewSource(time.Now().UnixNano()))
randomized = true
}

Expand Down

0 comments on commit 22f8578

Please sign in to comment.