22 lines
342 B
Go
22 lines
342 B
Go
|
package misc
|
||
|
|
||
|
import (
|
||
|
"math/rand"
|
||
|
"strings"
|
||
|
"time"
|
||
|
)
|
||
|
|
||
|
func GetRandomContent() string {
|
||
|
r := rand.New(rand.NewSource(time.Now().UnixNano()))
|
||
|
|
||
|
var result strings.Builder
|
||
|
charsetLength := len(CHARSET)
|
||
|
|
||
|
for i := 0; i < 6; i++ {
|
||
|
randomIndex := r.Intn(charsetLength)
|
||
|
result.WriteByte(CHARSET[randomIndex])
|
||
|
}
|
||
|
|
||
|
return result.String()
|
||
|
}
|