package utils import ( "crypto/rand" "math/big" ) func GenerateInviteCode() string { const charset = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" code := make([]byte, 8) for i := range code { n, _ := rand.Int(rand.Reader, big.NewInt(int64(len(charset)))) code[i] = charset[n.Int64()] } return string(code) } func GenerateVerifyCode() string { const charset = "0123456789" code := make([]byte, 6) for i := range code { n, _ := rand.Int(rand.Reader, big.NewInt(int64(len(charset)))) code[i] = charset[n.Int64()] } return string(code) }