github.com/itsabgr/go-handy@v0.0.0-20220724000257-022d51f2b9c6/rand.go (about)

     1  package handy
     2  
     3  import (
     4  	"crypto/rand"
     5  	"io"
     6  )
     7  
     8  func Rand(length int) []byte {
     9  	b := make([]byte, length)
    10  	_, err := io.ReadFull(rand.Reader, b)
    11  	Throw(err)
    12  	return b
    13  }