diff --git a/experiment/gerrit-onboarder/onboarder.go b/experiment/gerrit-onboarder/onboarder.go index 269bd0cacb2c..bcf3b79960a4 100644 --- a/experiment/gerrit-onboarder/onboarder.go +++ b/experiment/gerrit-onboarder/onboarder.go @@ -28,7 +28,6 @@ import ( "path" "regexp" "strings" - "time" "github.com/sirupsen/logrus" @@ -465,8 +464,6 @@ func main() { workDir = path.Join(workDir, getRepoClonedName(o.repo)) } - // Using math/rand instead of crypto/rand so we don't need to handle errors - rand.Seed(time.Now().UTC().UnixNano()) branchName := fmt.Sprintf("gerritOnboarding_%d", rand.Int()) if err = fetchMetaConfig(o.host, o.repo, branchName, workDir); err != nil { diff --git a/gcsweb/cmd/gcsweb/gcsweb.go b/gcsweb/cmd/gcsweb/gcsweb.go index 4bf04594b727..dfc9ce5dcf16 100644 --- a/gcsweb/cmd/gcsweb/gcsweb.go +++ b/gcsweb/cmd/gcsweb/gcsweb.go @@ -191,7 +191,6 @@ func main() { s := &server{storageClient: storageClient} logrus.Info("Starting GCSWeb") - rand.Seed(time.Now().UTC().UnixNano()) // Canonicalize allowed buckets. for i := range o.allowedBuckets { diff --git a/kubetest/kops.go b/kubetest/kops.go index 48dbd2d4c1a8..652a93646f34 100644 --- a/kubetest/kops.go +++ b/kubetest/kops.go @@ -40,6 +40,8 @@ import ( "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/ec2" + cryptorand "crypto/rand" + "golang.org/x/crypto/ssh" "k8s.io/test-infra/kubetest/e2e" @@ -894,7 +896,7 @@ func setupGCEStateStore(projectId string) (*string, error) { // gceBucketName generates a name for GCE state store bucket func gceBucketName(projectId string) string { b := make([]byte, 2) - rand.Read(b) + cryptorand.Read(b) s := hex.EncodeToString(b) return strings.Join([]string{projectId, "state", s}, "-") } diff --git a/kubetest/main.go b/kubetest/main.go index 9ba06d6a5474..0e45ed9e54fb 100644 --- a/kubetest/main.go +++ b/kubetest/main.go @@ -23,7 +23,6 @@ import ( "flag" "fmt" "log" - "math/rand" "os" "os/exec" "os/signal" @@ -280,9 +279,6 @@ func main() { log.SetFlags(log.LstdFlags | log.Lshortfile) log.Printf("Running kubetest version: %s\n", gitTag) - // Initialize global pseudo random generator. Initializing it to select random AWS Zones. - rand.Seed(time.Now().UnixNano()) - pflag.CommandLine = pflag.NewFlagSet(os.Args[0], pflag.ContinueOnError) o := defineFlags() pflag.CommandLine.AddGoFlagSet(flag.CommandLine) diff --git a/robots/commenter/main.go b/robots/commenter/main.go index db71e8ebfc1f..6d5e34620e0c 100644 --- a/robots/commenter/main.go +++ b/robots/commenter/main.go @@ -230,7 +230,6 @@ func run(c client, query, sort string, asc, random bool, commenter func(meta) (s problems := []string{} log.Printf("Found %d matches", len(issues)) if random { - rand.Seed(time.Now().UnixNano()) rand.Shuffle(len(issues), func(i, j int) { issues[i], issues[j] = issues[j], issues[i] })