discord-exploits/modules/name.go

18 lines
372 B
Go
Raw Normal View History

package modules
2021-01-11 11:21:44 +00:00
import (
"math/rand"
"time"
)
// CreateName generates a random file name
func CreateName(extension string) string {
charset := "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
b := make([]byte, 8)
rand.Seed(time.Now().UnixNano())
for i := range b {
b[i] = charset[rand.Intn(len(charset))]
}
2021-01-11 11:21:44 +00:00
return string(b) + "." + extension
}