pplx / utils /random.go
ernoban's picture
Upload 21 files
77551bd 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)
}