12345678910111213141516171819 |
- package util
- import "math/rand"
- var letterRunes = []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")
- // RandID .
- func RandID() int64 {
- return rand.Int63()
- }
- // RandStr .
- func RandStr(size int) string {
- b := make([]rune, size)
- for i := range b {
- b[i] = letterRunes[rand.Intn(len(letterRunes))]
- }
- return string(b)
- }
|