func GenerateUnique() string { var r = []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0") uniq := make([]rune,20) for i := range uniq { rand.Seed(time.Now().UTC().UnixNano() + int64(i<<20)) uniq[i] = r[rand.Intn(len(r))] } return string(uniq) }原文链接:https://www.f2er.com/go/188239.html