Fixes #11721 removed GenerateRandomString
Signed-off-by: Peter Esbensen <pkesbensen@gmail.com> gofmt Signed-off-by: Peter Esbensen <pkesbensen@gmail.com> Upstream-commit: 6896016b7c7a95ac33c77a222c359cf35a471eb9 Component: engine
This commit is contained in:
@ -1,23 +1,10 @@
|
||||
package stringutils
|
||||
|
||||
import (
|
||||
"crypto/rand"
|
||||
"encoding/hex"
|
||||
"io"
|
||||
mathrand "math/rand"
|
||||
"time"
|
||||
)
|
||||
|
||||
// Generate 32 chars random string
|
||||
func GenerateRandomString() string {
|
||||
id := make([]byte, 32)
|
||||
|
||||
if _, err := io.ReadFull(rand.Reader, id); err != nil {
|
||||
panic(err) // This shouldn't happen
|
||||
}
|
||||
return hex.EncodeToString(id)
|
||||
}
|
||||
|
||||
// Generate alpha only random stirng with length n
|
||||
func GenerateRandomAlphaOnlyString(n int) string {
|
||||
// make a really long string
|
||||
|
||||
Reference in New Issue
Block a user