github.com/cyverse/go-irodsclient@v0.13.2/irods/util/random.go (about) 1 package util 2 3 import ( 4 "math/rand" 5 "time" 6 ) 7 8 var ( 9 letters = []rune("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ") 10 ) 11 12 //MakeRandomString returns a random string 13 func MakeRandomString(size int) string { 14 rand.Seed(time.Now().UnixNano()) 15 16 b := make([]rune, size) 17 for i := 0; i < size; i++ { 18 b[i] = letters[rand.Intn(len(letters))] 19 } 20 21 bs := string(b) 22 return bs 23 }