This commit is contained in:
NatureFreshMilk 2019-01-29 18:00:00 +01:00
parent 2ae8559a40
commit ea7a938b40

20
server/app/util.go Normal file
View File

@ -0,0 +1,20 @@
package app
import (
"math/rand"
"time"
)
func init() {
rand.Seed(time.Now().UnixNano())
}
var letterRunes = []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")
func RandStringRunes(n int) string {
b := make([]rune, n)
for i := range b {
b[i] = letterRunes[rand.Intn(len(letterRunes))]
}
return string(b)
}