15 lines
307 B
Go
15 lines
307 B
Go
package utils
|
|
|
|
import (
|
|
"math/rand"
|
|
)
|
|
|
|
const charSet = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
|
|
|
|
func GenerateRandomString(length int) string {
|
|
result := make([]byte, length)
|
|
for i := 0; i < length; i++ {
|
|
result[i] = charSet[rand.Intn(len(charSet))]
|
|
}
|
|
return string(result)
|
|
}
|