2019-08-29 20:52:40 +00:00
|
|
|
package testutil // import "github.com/docker/docker/testutil"
|
2017-10-28 00:28:19 +00:00
|
|
|
|
|
|
|
import "math/rand"
|
|
|
|
|
|
|
|
// GenerateRandomAlphaOnlyString generates an alphabetical random string with length n.
|
|
|
|
func GenerateRandomAlphaOnlyString(n int) string {
|
|
|
|
// make a really long string
|
|
|
|
letters := []byte("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")
|
|
|
|
b := make([]byte, n)
|
|
|
|
for i := range b {
|
|
|
|
b[i] = letters[rand.Intn(len(letters))]
|
|
|
|
}
|
|
|
|
return string(b)
|
|
|
|
}
|