Files
armbian-router/util.go
2022-10-03 01:39:02 -04:00

15 lines
331 B
Go

package redirector
import "math/rand"
var letters = []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")
// RandomSequence is an insecure, but "good enough" random generator.
func RandomSequence(n int) string {
b := make([]rune, n)
for i := range b {
b[i] = letters[rand.Intn(len(letters))]
}
return string(b)
}