pplx2 / utils /random.go
FISHYA's picture
Upload 20 files
736337f verified
raw
history blame contribute delete
300 Bytes
package utils
import "math/rand"
func RandomString(length int) string {
const charset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
result := make([]byte, length)
for i := range result {
result[i] = charset[rand.Intn(len(charset))]
}
return string(result)
}