This commit is contained in:
2022-10-31 17:22:49 +08:00
parent 63c8b46474
commit 9f29f019ad
11 changed files with 96 additions and 99 deletions

View File

@@ -1,6 +1,6 @@
/**
* @Author: fuxiao
* @Email: 576101059@qq.com
* @Author: Echo
* @Email: 1711788888@qq.com
* @Date: 2021/8/26 4:51 下午
* @Desc: TODO
*/
@@ -17,12 +17,12 @@ var seedStr = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
// RandStr generate a string of specified length.
func RandStr(length int) (lastStr string) {
rand.Seed(time.Now().UnixNano())
pos, seedLen := 0, len(seedStr)
for i := 0; i < length; i++ {
pos = rand.Intn(seedLen)
lastStr += seedStr[pos : pos+1]
}
return lastStr
}