diff --git a/src/internal/chacha8rand/chacha8.go b/src/internal/chacha8rand/chacha8.go index e699096b57a37b..817e0354908a5c 100644 --- a/src/internal/chacha8rand/chacha8.go +++ b/src/internal/chacha8rand/chacha8.go @@ -160,7 +160,7 @@ func Unmarshal(s *State, data []byte) error { } // Read reads random bytes from the state into p. -func Read(s *State, p []byte) (n int, err error) { +func Read(s *State, p []byte) (n int) { for n = 0; n < len(p); n++ { for { x, ok := s.Next() diff --git a/src/math/rand/v2/chacha8.go b/src/math/rand/v2/chacha8.go index 9584a6c2c810e3..47400ff7c8c024 100644 --- a/src/math/rand/v2/chacha8.go +++ b/src/math/rand/v2/chacha8.go @@ -47,5 +47,5 @@ func (c *ChaCha8) MarshalBinary() ([]byte, error) { // Read generates len(p) random bytes and writes them into p. func (c *ChaCha8) Read(p []byte) (n int, err error) { - return chacha8rand.Read(&c.state, p) + return chacha8rand.Read(&c.state, p), nil }