1
0
mirror of https://github.com/nitezs/sub2clash.git synced 2024-12-23 15:24:42 -05:00
sub2clash/common/random_string.go

14 lines
296 B
Go
Raw Normal View History

package common
2023-09-17 03:52:37 -04:00
import "math/rand"
func RandomString(length int) string {
2024-08-11 11:55:47 -04:00
2023-09-17 03:52:37 -04:00
const charset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
var result []byte
for i := 0; i < length; i++ {
result = append(result, charset[rand.Intn(len(charset))])
}
return string(result)
}