Skip to content

Commit

Permalink
Change rand.Seed to rand.New
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-pbulawa committed Jun 25, 2024
1 parent 527d733 commit 24b6c54
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 13 deletions.
11 changes: 0 additions & 11 deletions put_get_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,10 @@ import (
"strconv"
"strings"
"testing"
"time"
)

const createStageStmt = "CREATE OR REPLACE STAGE %v URL = '%v' CREDENTIALS = (%v)"

func randomString(n int) string {
rand.Seed(time.Now().UnixNano())
alpha := []rune("abcdefghijklmnopqrstuvwxyz")
b := make([]rune, n)
for i := range b {
b[i] = alpha[rand.Intn(len(alpha))]
}
return string(b)
}

func TestPutError(t *testing.T) {
if isWindows {
t.Skip("permission model is different")
Expand Down
4 changes: 2 additions & 2 deletions telemetry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ func TestTelemetryAddLog(t *testing.T) {
enabled: true,
flushSize: defaultFlushSize,
}
rand.Seed(time.Now().UnixNano())
randNum := rand.Int() % 10000
r := rand.New(rand.NewSource(time.Now().UnixNano()))
randNum := r.Int() % 10000
for i := 0; i < randNum; i++ {
if err := st.addLog(&telemetryData{
Message: map[string]string{
Expand Down
10 changes: 10 additions & 0 deletions util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -390,3 +390,13 @@ func skipOnJenkins(t *testing.T, message string) {
t.Skip("Skipping test on Jenkins: " + message)
}
}

func randomString(n int) string {
r := rand.New(rand.NewSource(time.Now().UnixNano()))
alpha := []rune("abcdefghijklmnopqrstuvwxyz")
b := make([]rune, n)
for i := range b {
b[i] = alpha[r.Intn(len(alpha))]
}
return string(b)
}

0 comments on commit 24b6c54

Please sign in to comment.