Make random string generator better

This commit is contained in:
Adalricus Ovicula 2020-02-02 23:31:07 +05:30
parent 822df7fe35
commit 63cec1ffdc
Signed by: adalricus
GPG Key ID: C7DC4679EC6CE92D
1 changed files with 2 additions and 2 deletions

View File

@ -128,8 +128,8 @@ func errChk(err error) {
}
func randS(n int) string {
var alphaNum = []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789")
b := make([]rune, n)
const alphaNum = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
b := make([]byte, n)
for i := range b {
b[i] = alphaNum[rand.Intn(len(alphaNum))]
}