refactor: Tweak word selection PR

This commit is contained in:
Aetnaeus
2023-04-11 16:06:43 -04:00
parent 5a179f25b4
commit 65af3c3480

@ -83,20 +83,19 @@ func init() {
func randomText(n int, words []string) string { func randomText(n int, words []string) string {
r := "" r := ""
r += words[rand.Int()%len(words)]
r += " "
var last string var last string
for i := 0; i < n; i++ { for i := 0; i < n; i++ {
new := words[rand.Int()%len(words)] w := words[rand.Int()%len(words)]
for last == new { for last == w {
new = words[rand.Int()%len(words)] w = words[rand.Int()%len(words)]
} }
r += new r += w
last = new
if i != n-1 { if i != n-1 {
r += " " r += " "
} }
last = w
} }
return strings.Replace(r, "\n", " \n", -1) return strings.Replace(r, "\n", " \n", -1)