README 文件修改
This commit is contained in:
@@ -1,28 +0,0 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"math/rand"
|
||||
"time"
|
||||
)
|
||||
|
||||
func init() {
|
||||
rand.Seed(time.Now().UnixNano())
|
||||
}
|
||||
|
||||
func GenerateVerificationCode(length int) string {
|
||||
digits := "0123456789"
|
||||
code := make([]byte, length)
|
||||
for i := range code {
|
||||
code[i] = digits[rand.Intn(len(digits))]
|
||||
}
|
||||
return string(code)
|
||||
}
|
||||
|
||||
func GenerateRandomString(length int) string {
|
||||
chars := "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
|
||||
result := make([]byte, length)
|
||||
for i := range result {
|
||||
result[i] = chars[rand.Intn(len(chars))]
|
||||
}
|
||||
return string(result)
|
||||
}
|
||||
Reference in New Issue
Block a user