package main
import (
"fmt"
"math/rand"
"time"
)
func generateUniqueRandomString(total int) string {
chars := "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
charsLength := len(chars)
result := ""
usedChars := make(map[rune]bool)
rand.Seed(time.Now().UnixNano())
for len(result) < total {
randomIndex := rand.Intn(charsLength)
randomChar := rune(chars[randomIndex])
if !usedChars[randomChar] {
result += string(randomChar)
usedChars[randomChar] = true
}
}
return result
}
func main() {
fmt.Println(generateUniqueRandomString(15))
}
/*
run:
K9L6WdhtmnSB2sk
*/