Skip to content

Commit

Permalink
uprng.Reader doesn't need to be seeded at pkg init
Browse files Browse the repository at this point in the history
the time check take care of cover the first seed
  • Loading branch information
jrick committed Jun 11, 2024
1 parent 585fba6 commit 53f96d8
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions peer/internal/uprng/uprng.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
var Reader io.Reader

func init() {
Reader = newPRNG()
Reader = new(prng)
}

const (
Expand All @@ -39,12 +39,6 @@ type prng struct {
mu sync.Mutex
}

func newPRNG() *prng {
p := new(prng)
p.seed()
return p
}

func (p *prng) seed() {
_, err := cryptorand.Read(key)
if err != nil {
Expand Down

0 comments on commit 53f96d8

Please sign in to comment.