Ai
1 Star 0 Fork 0

五度曲橙/golang-wechat-sdk

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
string.go 398 Bytes
一键复制 编辑 原始数据 按行查看 历史
五度曲橙 提交于 2021-06-11 11:03 +08:00 . first commit
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 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/qucheng/golang-wechat-sdk.git
git@gitee.com:qucheng/golang-wechat-sdk.git
qucheng
golang-wechat-sdk
golang-wechat-sdk
a0c205eb99dc

搜索帮助