This commit is contained in:
david 2024-02-21 20:33:47 +08:00
parent 04537f27f0
commit a357fa225b
2 changed files with 5 additions and 5 deletions

2
go.mod
View File

@ -1,3 +1,3 @@
module git.apinb.com/bsm-sdk/engine module git.apinb.com/bsm-sdk/engine
go 1.21 go 1.22

View File

@ -1,11 +1,11 @@
package utils package utils
import ( import (
"math/rand" "math/rand/v2"
"time" "time"
) )
//随机生成字符串 // 随机生成字符串
func RandomString(l int) string { func RandomString(l int) string {
str := "0123456789AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz" str := "0123456789AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz"
bytes := []byte(str) bytes := []byte(str)
@ -17,7 +17,7 @@ func RandomString(l int) string {
return BytesToString(result) return BytesToString(result)
} }
//随机生成纯字符串 // 随机生成纯字符串
func RandomPureString(l int) string { func RandomPureString(l int) string {
str := "AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz" str := "AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz"
bytes := []byte(str) bytes := []byte(str)
@ -29,7 +29,7 @@ func RandomPureString(l int) string {
return BytesToString(result) return BytesToString(result)
} }
//随机生成数字字符串 // 随机生成数字字符串
func RandomNumber(l int) string { func RandomNumber(l int) string {
str := "0123456789" str := "0123456789"
bytes := []byte(str) bytes := []byte(str)