feat(rands): initial implementation

This commit is contained in:
2021-01-20 02:57:34 +00:00
parent 3ddcfd415c
commit 597fe535d3
18 changed files with 1603 additions and 1 deletions

14
bytes.go Normal file
View File

@@ -0,0 +1,14 @@
package rands
import "crypto/rand"
// Bytes generates a byte slice of n number of random bytes.
func Bytes(n int) ([]byte, error) {
b := make([]byte, n)
_, err := rand.Read(b)
if err != nil {
return nil, err
}
return b, nil
}