14 lines
303 B
Go
14 lines
303 B
Go
|
package controller
|
||
|
|
||
|
import "math/rand"
|
||
|
|
||
|
func GenerateAlnumString(length int) []byte {
|
||
|
const CHARS = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
|
||
|
res := []byte{}
|
||
|
for i := 0; i < length; i++ {
|
||
|
res = append(res, CHARS[rand.Intn(len(CHARS))])
|
||
|
}
|
||
|
return res
|
||
|
}
|
||
|
|