diff --git a/pkg/adt/interval_tree_test.go b/pkg/adt/interval_tree_test.go index 1e1a05a6452..1e8557078a7 100644 --- a/pkg/adt/interval_tree_test.go +++ b/pkg/adt/interval_tree_test.go @@ -18,7 +18,6 @@ import ( "math/rand" "reflect" "testing" - "time" ) // TestIntervalTreeInsert tests interval tree insertion. @@ -360,7 +359,6 @@ func TestIntervalTreeRandom(t *testing.T) { ivs := make(map[xy]struct{}) ivt := NewIntervalTree() maxv := 128 - rand.Seed(time.Now().UnixNano()) for i := rand.Intn(maxv) + 1; i != 0; i-- { x, y := int64(rand.Intn(maxv)), int64(rand.Intn(maxv)) diff --git a/pkg/proxy/server.go b/pkg/proxy/server.go index 72a0c7483d2..96f30bd7d4a 100644 --- a/pkg/proxy/server.go +++ b/pkg/proxy/server.go @@ -806,7 +806,6 @@ func computeLatency(lat, rv time.Duration) time.Duration { rv = lat / 10 } now := time.Now() - mrand.Seed(int64(now.Nanosecond())) sign := 1 if now.Second()%2 == 0 { sign = -1 diff --git a/pkg/proxy/server_test.go b/pkg/proxy/server_test.go index 6690c619d11..d19c947c646 100644 --- a/pkg/proxy/server_test.go +++ b/pkg/proxy/server_test.go @@ -628,7 +628,6 @@ func testServerHTTP(t *testing.T, secure, delayTx bool) { func newUnixAddr() string { now := time.Now().UnixNano() - rand.Seed(now) addr := fmt.Sprintf("%X%X.unix-conn", now, rand.Intn(35000)) os.RemoveAll(addr) return addr diff --git a/pkg/stringutil/rand.go b/pkg/stringutil/rand.go index 96d9df311cf..347ee7c2b46 100644 --- a/pkg/stringutil/rand.go +++ b/pkg/stringutil/rand.go @@ -16,7 +16,6 @@ package stringutil import ( "math/rand" - "time" ) // UniqueStrings returns a slice of randomly generated unique strings. @@ -45,7 +44,6 @@ func RandomStrings(slen uint, n int) (ss []string) { const chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" func RandString(l uint) string { - rand.Seed(time.Now().UnixNano()) s := make([]byte, l) for i := 0; i < int(l); i++ { s[i] = chars[rand.Intn(len(chars))] diff --git a/server/etcdserver/server.go b/server/etcdserver/server.go index 4a2128104c9..b18c1cce74e 100644 --- a/server/etcdserver/server.go +++ b/server/etcdserver/server.go @@ -20,7 +20,6 @@ import ( "expvar" "fmt" "math" - "math/rand" "net/http" "path" "regexp" @@ -120,8 +119,6 @@ var ( ) func init() { - rand.Seed(time.Now().UnixNano()) - expvar.Publish( "file_descriptor_limit", expvar.Func( diff --git a/server/lease/lessor_bench_test.go b/server/lease/lessor_bench_test.go index 71e970e5f25..73cdbede30d 100644 --- a/server/lease/lessor_bench_test.go +++ b/server/lease/lessor_bench_test.go @@ -37,10 +37,6 @@ func BenchmarkLessorRenew100000(b *testing.B) { benchmarkLessorRenew(100000, b) func BenchmarkLessorFindExpired10000(b *testing.B) { benchmarkLessorFindExpired(10000, b) } func BenchmarkLessorFindExpired100000(b *testing.B) { benchmarkLessorFindExpired(100000, b) } -func init() { - rand.Seed(time.Now().UTC().UnixNano()) -} - const ( // minTTL keep lease will not auto expire in benchmark minTTL = 1000 diff --git a/tests/integration/clientv3/snapshot/v3_snapshot_test.go b/tests/integration/clientv3/snapshot/v3_snapshot_test.go index 01115d04ba0..5f4fb2adc8d 100644 --- a/tests/integration/clientv3/snapshot/v3_snapshot_test.go +++ b/tests/integration/clientv3/snapshot/v3_snapshot_test.go @@ -130,7 +130,6 @@ func createSnapshotFile(t *testing.T, cfg *embed.Config, kvs []kv) (version stri func newEmbedURLs(n int) (urls []url.URL) { urls = make([]url.URL, n) for i := 0; i < n; i++ { - rand.Seed(int64(time.Now().Nanosecond())) u, _ := url.Parse(fmt.Sprintf("unix://localhost:%d", rand.Intn(45000))) urls[i] = *u }