github.com/caos/orbos@v1.5.14-0.20221103111702-e6cd0cea7ad4/pkg/helper/rand.go (about)

     1  package helper
     2  
     3  import "math/rand"
     4  
     5  const letterBytes = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
     6  
     7  func RandStringBytes(n int) string {
     8  	b := make([]byte, n)
     9  	for i := range b {
    10  		b[i] = letterBytes[rand.Intn(len(letterBytes))]
    11  	}
    12  	return string(b)
    13  }