GofileScrapper/misc/generator.go

22 lines
342 B
Go
Raw Normal View History

2024-03-19 16:20:55 +00:00
package misc
import (
"math/rand"
"strings"
"time"
)
func GetRandomContent() string {
r := rand.New(rand.NewSource(time.Now().UnixNano()))
var result strings.Builder
2024-03-20 09:10:20 +00:00
charsetLength := len(Charset)
2024-03-19 16:20:55 +00:00
for i := 0; i < 6; i++ {
randomIndex := r.Intn(charsetLength)
2024-03-20 09:10:20 +00:00
result.WriteByte(Charset[randomIndex])
2024-03-19 16:20:55 +00:00
}
return result.String()
}