1234567891011121314151617 |
- package unity
- import (
- "math/rand"
- "time"
- )
- func RandomId() string {
- const letterBytes = "abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
- rand.Seed(time.Now().UnixNano())
- b := make([]byte, 32)
- for i := range b {
- b[i] = letterBytes[rand.Intn(len(letterBytes))]
- }
- return string(b)
- }
|