From 4154f9c642333237ac659a560a30bfb37802e4c2 Mon Sep 17 00:00:00 2001 From: James Blair Date: Sat, 19 Aug 2023 22:16:51 +1200 Subject: [PATCH] Remove deprecated rand.Seed calls. From go 1.20 if Seed is not called, the generator will be seeded randomly at program startup. Signed-off-by: James Blair --- cmd/bbolt/main_test.go | 1 - freelist_test.go | 1 - simulation_test.go | 2 -- 3 files changed, 4 deletions(-) diff --git a/cmd/bbolt/main_test.go b/cmd/bbolt/main_test.go index dddacd8..dbc7de7 100644 --- a/cmd/bbolt/main_test.go +++ b/cmd/bbolt/main_test.go @@ -461,7 +461,6 @@ func TestCompactCommand_Run(t *testing.T) { if err := binary.Read(crypto.Reader, binary.BigEndian, &s); err != nil { t.Fatal(err) } - rand.Seed(s) dstdb := btesting.MustCreateDB(t) dstdb.Close() diff --git a/freelist_test.go b/freelist_test.go index 0989dad..7297055 100644 --- a/freelist_test.go +++ b/freelist_test.go @@ -322,7 +322,6 @@ func benchmark_FreelistRelease(b *testing.B, size int) { } func randomPgids(n int) []common.Pgid { - rand.Seed(42) pgids := make(common.Pgids, n) for i := range pgids { pgids[i] = common.Pgid(rand.Int63()) diff --git a/simulation_test.go b/simulation_test.go index 037b718..6f4d5b2 100644 --- a/simulation_test.go +++ b/simulation_test.go @@ -35,8 +35,6 @@ func testSimulate(t *testing.T, openOption *bolt.Options, round, threadCount, pa t.Skip("skipping test in short mode.") } - rand.Seed(int64(qseed)) - // A list of operations that readers and writers can perform. var readerHandlers = []simulateHandler{simulateGetHandler} var writerHandlers = []simulateHandler{simulateGetHandler, simulatePutHandler}