You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
341 B
16 lines
341 B
package owl
|
|
|
|
import (
|
|
"crypto/rand"
|
|
"math/big"
|
|
)
|
|
|
|
func GenerateRandomString(length int) string {
|
|
chars := []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789")
|
|
b := make([]rune, length)
|
|
for i := range b {
|
|
k, _ := rand.Int(rand.Reader, big.NewInt(int64(len(chars))))
|
|
b[i] = chars[k.Int64()]
|
|
}
|
|
return string(b)
|
|
}
|
|
|