evcc-io/util/helper.go
2022-07-12 11:20:05 +02:00

15 lines
317 B
Go

package util
import (
"math/rand"
)
// RandomString creates random string of N integers
func RandomString(n int) string {
letters := []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789")
s := make([]rune, n)
for i := range s {
s[i] = letters[rand.Intn(len(letters))]
}
return string(s)
}