Co-authored-by: Kurami <178341547+Kurami32@users.noreply.github.com> Co-authored-by: Socramk <155040241+socramcaro2@users.noreply.github.com>
47 lines
950 B
Go
47 lines
950 B
Go
package utils
|
|
|
|
import (
|
|
"time"
|
|
|
|
"math/rand"
|
|
)
|
|
|
|
func GenerateRandomPath(levels int) string {
|
|
rand.New(rand.NewSource(time.Now().UnixNano()))
|
|
dirName := "srv"
|
|
for i := 0; i < levels; i++ {
|
|
dirName += "/" + GetRandomTerm()
|
|
}
|
|
return dirName
|
|
}
|
|
|
|
func GetRandomTerm() string {
|
|
wordbank := []string{
|
|
"hi", "test", "other", "name",
|
|
"cool", "things", "more", "items",
|
|
}
|
|
rand.New(rand.NewSource(time.Now().UnixNano()))
|
|
|
|
index := rand.Intn(len(wordbank))
|
|
return wordbank[index]
|
|
}
|
|
|
|
func GetRandomExtension() string {
|
|
wordbank := []string{
|
|
".txt", ".mp3", ".mov", ".doc",
|
|
".mp4", ".bak", ".zip", ".jpg",
|
|
}
|
|
rand.New(rand.NewSource(time.Now().UnixNano()))
|
|
index := rand.Intn(len(wordbank))
|
|
return wordbank[index]
|
|
}
|
|
|
|
func GenerateRandomSearchTerms(numTerms int) []string {
|
|
// Generate random search terms
|
|
searchTerms := make([]string, numTerms)
|
|
for i := 0; i < numTerms; i++ {
|
|
searchTerms[i] = GetRandomTerm()
|
|
}
|
|
return searchTerms
|
|
}
|