12 lines
178 B
Go
12 lines
178 B
Go
package rnd
|
|
|
|
import "crypto/rand"
|
|
|
|
func RandomBytes(n int) ([]byte, error) {
|
|
b := make([]byte, n)
|
|
_, err := rand.Read(b)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return b, nil
|
|
}
|