photoprism/pkg/rnd/bytes.go
2021-09-08 14:21:57 +02:00

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
}