mirror of
https://github.com/moul/sshportal.git
synced 2025-01-08 00:18:38 +08:00
14 lines
272 B
Go
14 lines
272 B
Go
|
package main
|
||
|
|
||
|
import "math/rand"
|
||
|
|
||
|
const letterBytes = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
|
||
|
|
||
|
func RandStringBytes(n int) string {
|
||
|
b := make([]byte, n)
|
||
|
for i := range b {
|
||
|
b[i] = letterBytes[rand.Intn(len(letterBytes))]
|
||
|
}
|
||
|
return string(b)
|
||
|
}
|