mirror of
https://github.com/portainer/portainer.git
synced 2025-07-19 21:39:40 +02:00
15 lines
326 B
Go
15 lines
326 B
Go
|
package randomstring
|
||
|
|
||
|
import "math/rand"
|
||
|
|
||
|
const letterBytes = "abcdefghijklmnopqrstuvwxyz0123456789"
|
||
|
|
||
|
// RandomString returns a random lowercase alphanumeric string of length n
|
||
|
func RandomString(n int) string {
|
||
|
b := make([]byte, n)
|
||
|
for i := range b {
|
||
|
b[i] = letterBytes[rand.Intn(len(letterBytes))]
|
||
|
}
|
||
|
return string(b)
|
||
|
}
|