1
0
mirror of https://github.com/nitezs/sub2clash.git synced 2024-12-23 21:44:41 -05:00
sub2clash/common/random_string.go
Nite07 ac4ad3c8aa ♻️ Refactor code
🔥 Remove update detection
2024-04-23 14:47:53 +08:00

14 lines
321 B
Go

package common
import "math/rand"
func RandomString(length int) string {
// 生成随机字符串
const charset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
var result []byte
for i := 0; i < length; i++ {
result = append(result, charset[rand.Intn(len(charset))])
}
return string(result)
}