const ( defaultTokenLen int = 16 ) func GenerateToken() string { rand.Seed(time.Now().UnixNano()) runes := []rune("abcdefghijklmnopqrstuvwxyz0123456789") b := make([]rune, defaultTokenLen) for i := range b { b[i] = runes[rand.Intn(len(runes))] } return string(b) }
标签:rand,string,runes,token,defaultTokenLen,随机,go From: https://www.cnblogs.com/ccdr/p/17606065.html