GetRandomString 生成随机字符串
(num int)
| 85 | |
| 86 | //GetRandomString 生成随机字符串 |
| 87 | func GetRandomString(num int) string { |
| 88 | str := "123456789abcdefghijklmnpqrstuvwxyzABCDEFGHIJKLMNPQRSTUVWXYZ" |
| 89 | bytes := []byte(str) |
| 90 | result := []byte{} |
| 91 | r := rand.New(rand.NewSource(time.Now().UnixNano())) |
| 92 | for i := 0; i < num; i++ { |
| 93 | result = append(result, bytes[r.Intn(len(bytes))]) |
| 94 | } |
| 95 | return string(result) |
| 96 | } |
| 97 | |
| 98 | //CheckFileIsExist 判断文件是否存在 存在返回 true 不存在返回false |
| 99 | func CheckFileIsExist(filename string) bool { |
no test coverage detected