ab6864d0c0
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
15 lines
286 B
Go
15 lines
286 B
Go
package utils
|
|
|
|
import (
|
|
"crypto/rand"
|
|
"encoding/hex"
|
|
"io"
|
|
)
|
|
|
|
func GenerateRandomName(prefix string, size int) (string, error) {
|
|
id := make([]byte, 32)
|
|
if _, err := io.ReadFull(rand.Reader, id); err != nil {
|
|
return "", err
|
|
}
|
|
return prefix + hex.EncodeToString(id)[:size], nil
|
|
}
|