b32a970aab
Signed-off-by: Michael Mayer <michael@photoprism.app>
13 lines
240 B
Go
13 lines
240 B
Go
package rnd
|
|
|
|
import "crypto/rand"
|
|
|
|
// RandomBytes returns cryptographically secure random bytes.
|
|
func RandomBytes(n int) ([]byte, error) {
|
|
b := make([]byte, n)
|
|
_, err := rand.Read(b)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return b, nil
|
|
}
|