Ai
1 Star 0 Fork 0

zhd/wechat

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
string.go 399 Bytes
一键复制 编辑 原始数据 按行查看 历史
package util
import (
"math/rand"
"time"
)
// RandomStr 随机生成字符串
func RandomStr(length int) string {
str := "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
bytes := []byte(str)
result := []byte{}
r := rand.New(rand.NewSource(time.Now().UnixNano()))
for i := 0; i < length; i++ {
result = append(result, bytes[r.Intn(len(bytes))])
}
return string(result)
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/zhd--zhd_admin/wechat.git
git@gitee.com:zhd--zhd_admin/wechat.git
zhd--zhd_admin
wechat
wechat
v2.1.8

搜索帮助