github.com/ari-anchor/sei-tendermint@v0.0.0-20230519144642-dc826b7b56bb/crypto/random.go (about)

     1  package crypto
     2  
     3  import (
     4  	"crypto/rand"
     5  	"io"
     6  )
     7  
     8  // This only uses the OS's randomness
     9  func CRandBytes(numBytes int) []byte {
    10  	b := make([]byte, numBytes)
    11  	_, err := rand.Read(b)
    12  	if err != nil {
    13  		panic(err)
    14  	}
    15  	return b
    16  }
    17  
    18  // Returns a crand.Reader.
    19  func CReader() io.Reader {
    20  	return rand.Reader
    21  }