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.

21 lines
336B

  1. package main
  2. import (
  3. "math/rand"
  4. "time"
  5. )
  6. func randinit() {
  7. rand.Seed(time.Now().UnixNano())
  8. }
  9. var letterRunes = []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")
  10. func RandStringRunes(n int) string {
  11. b := make([]rune, n)
  12. for i := range b {
  13. b[i] = letterRunes[rand.Intn(len(letterRunes))]
  14. }
  15. return string(b)
  16. }