I am trying to generate an entropy using crypto/rand instead of math/rand, and my entropy needs to be of type io.Reader.
//using math/rand
src := mathrand.NewSource(123)
entropy := mathrand.New(src)
I would appreciate all the suggestions!
I am trying to generate an entropy using crypto/rand instead of math/rand, and my entropy needs to be of type io.Reader.
//using math/rand
src := mathrand.NewSource(123)
entropy := mathrand.New(src)
I would appreciate all the suggestions!
It's right at the top of the package doc: https://pkg.go.dev/crypto/rand#pkg-variables
Reader is a global, shared instance of a cryptographically secure random number generator.
Just use rand.Reader
.