Skip to content

Commit

Permalink
No need to rand.Seed in go 1.20
Browse files Browse the repository at this point in the history
  • Loading branch information
muXxer committed Feb 23, 2023
1 parent 1ae2b32 commit 9f86e64
Show file tree
Hide file tree
Showing 11 changed files with 0 additions and 27 deletions.
3 changes: 0 additions & 3 deletions packages/chain/chainMgr/chainMgr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ package chainMgr_test

import (
"fmt"
"math/rand"
"testing"
"time"

"github.com/stretchr/testify/require"

Expand Down Expand Up @@ -48,7 +46,6 @@ func TestBasic(t *testing.T) {
}

func testBasic(t *testing.T, n, f int) {
rand.Seed(time.Now().UnixNano())
log := testlogger.NewLogger(t)
defer log.Sync()
//
Expand Down
3 changes: 0 additions & 3 deletions packages/chain/cmtLog/cmtLog_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ package cmtLog_test

import (
"fmt"
"math/rand"
"testing"
"time"

"github.com/stretchr/testify/require"

Expand Down Expand Up @@ -40,7 +38,6 @@ func TestBasic(t *testing.T) {
}

func testBasic(t *testing.T, n, f int) {
rand.Seed(time.Now().UnixNano())
log := testlogger.NewLogger(t)
defer log.Sync()
//
Expand Down
3 changes: 0 additions & 3 deletions packages/chain/cons/cons_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ package cons_test
import (
"context"
"fmt"
"math/rand"
"sync"
"sync/atomic"
"testing"
Expand Down Expand Up @@ -65,7 +64,6 @@ func TestBasic(t *testing.T) {

func testBasic(t *testing.T, n, f int) {
t.Parallel()
rand.Seed(time.Now().UnixNano())
log := testlogger.NewLogger(t)
defer log.Sync()
//
Expand Down Expand Up @@ -295,7 +293,6 @@ func TestChained(t *testing.T) {

func testChained(t *testing.T, n, f, b int) {
t.Parallel()
rand.Seed(time.Now().UnixNano())
log := testlogger.NewLogger(t)
defer log.Sync()
//
Expand Down
2 changes: 0 additions & 2 deletions packages/chain/cons/gr/gr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ package consGR_test
import (
"context"
"fmt"
"math/rand"
"sync"
"testing"
"time"
Expand Down Expand Up @@ -64,7 +63,6 @@ func TestBasic(t *testing.T) {

func testGeneric(t *testing.T, n, f int, reliable bool) {
t.Parallel()
rand.Seed(time.Now().UnixNano())
log := testlogger.NewLogger(t)
defer log.Sync()
//
Expand Down
3 changes: 0 additions & 3 deletions packages/chain/dss/dss_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ package dss_test

import (
"bytes"
"math/rand"
"testing"
"time"

"github.com/stretchr/testify/require"
"go.dedis.ch/kyber/v3"
Expand All @@ -22,7 +20,6 @@ import (
)

func TestBasic(t *testing.T) {
rand.Seed(time.Now().UnixNano())
log := testlogger.WithLevel(testlogger.NewLogger(t), logger.LevelWarn, false)
defer log.Sync()
suite := tcrypto.DefaultEd25519Suite()
Expand Down
3 changes: 0 additions & 3 deletions packages/chain/dss/trivial_dkg_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@
package dss_test

import (
"math/rand"
"testing"
"time"

"go.dedis.ch/kyber/v3"
"go.dedis.ch/kyber/v3/share"
Expand All @@ -26,7 +24,6 @@ import (
func TestDSS(t *testing.T) {
n := 4
f := 1
rand.Seed(time.Now().UnixNano())
suite := tcrypto.DefaultEd25519Suite()
nodeIDs := gpa.MakeTestNodeIDs(n)
nodeSKs := map[gpa.NodeID]kyber.Scalar{}
Expand Down
1 change: 0 additions & 1 deletion packages/chain/mempool/distSync/distSync_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ func TestBasic(t *testing.T) {

func testBasic(t *testing.T, n, cmtN, cmtF int) {
require.GreaterOrEqual(t, n, cmtN)
rand.Seed(time.Now().UnixNano())
log := testlogger.NewLogger(t)
kp := cryptolib.NewKeyPair()
rnd := rand.New(rand.NewSource(time.Now().UnixNano()))
Expand Down
3 changes: 0 additions & 3 deletions packages/chain/mempool/mempool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ func TestBasic(t *testing.T) {
// - Get proposals -- all received 1 request.
func testBasic(t *testing.T, n, f int, reliable bool) {
t.Parallel()
rand.Seed(time.Now().UnixNano())
te := newEnv(t, n, f, reliable)
defer te.close()
chainInitReqs := te.tcl.MakeTxChainInit()
Expand Down Expand Up @@ -207,7 +206,6 @@ func TestTimeLock(t *testing.T) {

func testTimeLock(t *testing.T, n, f int, reliable bool) { //nolint: gocyclo
t.Parallel()
rand.Seed(time.Now().UnixNano())
te := newEnv(t, n, f, reliable)
defer te.close()
start := time.Now()
Expand Down Expand Up @@ -325,7 +323,6 @@ func TestExpiration(t *testing.T) {

func testExpiration(t *testing.T, n, f int, reliable bool) {
t.Parallel()
rand.Seed(time.Now().UnixNano())
te := newEnv(t, n, f, reliable)
defer te.close()
start := time.Now()
Expand Down
2 changes: 0 additions & 2 deletions packages/chain/mempool/time_pool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
package mempool_test

import (
"math/rand"
"testing"
"time"

Expand All @@ -18,7 +17,6 @@ import (
)

func TestTimePoolBasic(t *testing.T) {
rand.Seed(time.Now().UnixNano())
kp := cryptolib.NewKeyPair()
tp := mempool.NewTimePool()
t0 := time.Now()
Expand Down
3 changes: 0 additions & 3 deletions packages/chain/mempool/wait_req_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ package mempool_test

import (
"context"
"math/rand"
"testing"
"time"

"github.com/stretchr/testify/require"

Expand All @@ -17,7 +15,6 @@ import (
)

func TestWaitReq(t *testing.T) {
rand.Seed(time.Now().UnixNano())
kp := cryptolib.NewKeyPair()

ctxA := context.Background()
Expand Down
1 change: 0 additions & 1 deletion packages/chain/node_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ func TestBasic(t *testing.T) {
//nolint:gocyclo
func testBasic(t *testing.T, n, f int, reliable bool, timeout time.Duration) {
t.Parallel()
rand.Seed(time.Now().UnixNano())
te := newEnv(t, n, f, reliable)
defer te.close()

Expand Down

0 comments on commit 9f86e64

Please sign in to comment.