mirror of
https://github.com/genuinetools/reg.git
synced 2024-09-11 22:01:02 -04:00
15 lines
389 B
Go
15 lines
389 B
Go
![]() |
package testutil
|
||
|
|
||
|
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)
|
||
|
}
|