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:
Peter Esbensen
2015-04-01 07:21:07 -07:00
parent aa32736c19
commit 64b84b5716
4 changed files with 6 additions and 41 deletions

View File

@ -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