package utils import ( "encoding/hex" "math/rand" "time" ) const alphabet = "1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" func init() { rand.Seed(time.Now().UnixNano()) } func GenerateRandomString(n int) string { b := make([]byte, n/2) if _, err := rand.Read(b); err != nil { panic(err) } return hex.EncodeToString(b) }