mirror of
https://github.com/silenceper/wechat.git
synced 2026-11-16 05:12:03 +08:00
oauth2,jssdk
This commit is contained in:
1 parent
3854bb0487
commit
4333691b37
21 files changed
+913
-43
No files matched your search
@@ -0,0 +1,18 @@
|
||||
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)
|
||||
}
|
||||
Reference in new issue
Block a user