mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-08-02 10:53:39 -04:00
Bumps [github.com/gookit/config/v2](https://github.com/gookit/config) from 2.2.5 to 2.2.6. - [Release notes](https://github.com/gookit/config/releases) - [Commits](https://github.com/gookit/config/compare/v2.2.5...v2.2.6) --- updated-dependencies: - dependency-name: github.com/gookit/config/v2 dependency-version: 2.2.6 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com>
28 lines
451 B
Go
28 lines
451 B
Go
//go:build !windows
|
|
|
|
package strutil
|
|
|
|
import (
|
|
"math/rand"
|
|
"time"
|
|
)
|
|
|
|
var rn = newRand()
|
|
|
|
func newRand() *rand.Rand {
|
|
return rand.New(rand.NewSource(time.Now().UnixNano()))
|
|
}
|
|
|
|
// buildRandomString 生成随机字符串
|
|
func buildRandomString(letters string, length int) string {
|
|
// rn := newRand()
|
|
cs := make([]byte, length)
|
|
|
|
lettersN := len(letters)
|
|
for i := 0; i < length; i++ {
|
|
cs[i] = letters[rn.Intn(lettersN)]
|
|
}
|
|
|
|
return Byte2str(cs)
|
|
}
|