Skip to content

Commit

Permalink
better random seeds
Browse files Browse the repository at this point in the history
  • Loading branch information
swgillespie committed Feb 14, 2024
1 parent 45f46c2 commit 775a2b1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion internal/provider/namespace_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"
"math/rand"
"testing"
"time"

"github.com/hashicorp/terraform-plugin-testing/helper/resource"
)
Expand Down Expand Up @@ -112,10 +113,11 @@ PEM
}

func randomString(length int) string {
r := rand.New(rand.NewSource(time.Now().UTC().UnixNano()))
const charset = "abcdefghijklmnopqrstuvwxyz"
b := make([]byte, length)
for i := range b {
b[i] = charset[rand.Intn(len(charset))]
b[i] = charset[r.Intn(len(charset))]
}
return string(b)
}

0 comments on commit 775a2b1

Please sign in to comment.