Make random string generator better
This commit is contained in:
parent
822df7fe35
commit
63cec1ffdc
4
main.go
4
main.go
|
@ -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))]
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue