mirror of
https://github.com/gotenberg/gotenberg.git
synced 2026-08-16 12:22:17 +01:00
v3.0.0 (#18)
This commit is contained in:
17
internal/pkg/rand/rand.go
Normal file
17
internal/pkg/rand/rand.go
Normal file
@@ -0,0 +1,17 @@
|
||||
package rand
|
||||
|
||||
import (
|
||||
"crypto/rand"
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// Get returns a random string.
|
||||
func Get() (string, error) {
|
||||
randBytes := make([]byte, 16)
|
||||
_, err := rand.Read(randBytes)
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("creating random string: %v", err)
|
||||
}
|
||||
return hex.EncodeToString(randBytes), nil
|
||||
}
|
||||
Reference in New Issue
Block a user