"crypto/rand"funcgetUuid()string{
b :=make([]byte,16)
io.ReadFull(rand.Reader, b)
b[6]=(b[6]&0x0f)|0x40
b[8]=(b[8]&0x3f)|0x80return fmt.Sprintf("%x-%x-%x-%x-%x", b[0:4], b[4:6], b[6:8], b[8:10], b[10:])}
三,生成随机字符串(大写)
//生成随机字符串 这个不怎么准 易出现相同的funcRandString(lenint)string{
r := rand.New(rand.NewSource(time.Now().Unix()))
bytes :=make([]byte,len)for i :=0; i <len; i++{
b := r.Intn(26)+65
bytes[i]=byte(b)}returnstring(bytes)}