Fixes #11721 removed GenerateRandomString
Signed-off-by: Peter Esbensen <pkesbensen@gmail.com> gofmt Signed-off-by: Peter Esbensen <pkesbensen@gmail.com>
This commit is contained in:
parent
ae440baf74
commit
88e878b013
2 changed files with 2 additions and 37 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue