Skip to content

Commit 1b1c6f6

Browse files
committed
Use newer math/rand/v2
1 parent f44379d commit 1b1c6f6

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

testing/docker.go

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,10 @@ import (
1515
dockerclient "github.com/docker/docker/client"
1616
"github.com/hashicorp/go-multierror"
1717
"io"
18-
"math/rand"
18+
"math/rand/v2"
1919
"strconv"
2020
"strings"
2121
"testing"
22-
"time"
2322
)
2423

2524
func NewDockerContainer(t testing.TB, image string, env []string, cmd []string) (*DockerContainer, error) {
@@ -286,15 +285,11 @@ type dockerImagePullOutput struct {
286285
Progress string `json:"progress"`
287286
}
288287

289-
func init() {
290-
rand.Seed(time.Now().UnixNano())
291-
}
292-
293288
func pseudoRandStr(n int) string {
294289
var letterRunes = []rune("abcdefghijklmnopqrstuvwxyz0123456789")
295290
b := make([]rune, n)
296291
for i := range b {
297-
b[i] = letterRunes[rand.Intn(len(letterRunes))]
292+
b[i] = letterRunes[rand.IntN(len(letterRunes))]
298293
}
299294
return string(b)
300295
}

0 commit comments

Comments
 (0)