You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

12 lines
175 B

  1. package common
  2. import "crypto/rand"
  3. func RandStr(length int) string {
  4. b := make([]byte, length)
  5. _, err := rand.Read(b)
  6. if err != nil {
  7. return ""
  8. }
  9. return string(b)
  10. }