videoplayer/worker/tool.go

14 lines
271 B
Go
Raw Normal View History

2025-03-18 14:00:37 +08:00
package worker
import "math/rand"
func GetRandomString(l int) string {
str := "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
bytes := []byte(str)
var result []byte
for i := 0; i < l; i++ {
result = append(result, bytes[rand.Intn(len(bytes))])
}
return string(result)
}