Fix: rand seeding error / Test: conf/version and util

This commit is contained in:
HFO4
2019-11-09 19:47:26 +08:00
parent 3ed1a5dc43
commit f453b3e918
4 changed files with 58 additions and 2 deletions

View File

@@ -2,14 +2,12 @@ package util
import (
"math/rand"
"time"
)
// RandStringRunes 返回随机字符串
func RandStringRunes(n int) string {
var letterRunes = []rune("1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")
rand.Seed(time.Now().UnixNano())
b := make([]rune, n)
for i := range b {
b[i] = letterRunes[rand.Intn(len(letterRunes))]