uitls.go 320 B

12345678910111213141516171819
  1. package utils
  2. import (
  3. "math/rand"
  4. "strings"
  5. "time"
  6. )
  7. func RandString() string {
  8. rand.Seed(time.Now().UnixNano())
  9. chars := []rune("abcdefghijklmnopqrstuvwxyz" +
  10. "0123456789")
  11. length := 24
  12. var b strings.Builder
  13. for i := 0; i < length; i++ {
  14. b.WriteRune(chars[rand.Intn(len(chars))])
  15. }
  16. return b.String()
  17. }