package main import ( "crypto/rand" "embed" "flag" "fmt" "math/big" "strings" ) var ( //go:embed resources res embed.FS // embed the resources/nouns.txt & resources/verbs.txt files as arrays of strings split by newlines nouns []string verbs []string ) var count int func init() { nounsContents, _ := res.ReadFile("resources/nouns.txt") nouns = strings.Split(string(nounsContents), "\n") verbsContents, _ := res.ReadFile("resources/verbs.txt") verbs = strings.Split(string(verbsContents), "\n") flag.IntVar(&count, "count", 10, "number of nouns and verbs to print") } func main() { flag.Parse() fmt.Println("count is ", count) // Print the first 10 nouns and verbs for i := 0; i < count; i++ { randomNounIdx, _ := rand.Int(rand.Reader, big.NewInt(int64(len((nouns))))) randomVerbIdx, _ := rand.Int(rand.Reader, big.NewInt(int64(len((verbs))))) fmt.Printf("%s-%s\n", nouns[randomNounIdx.Int64()], verbs[randomVerbIdx.Int64()]) } }