bytes.go

Summary

Maintainability
A
0 mins
Test Coverage
C
71%
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
}