From 8aad9f93e46727e48113072763da023deaa80234 Mon Sep 17 00:00:00 2001 From: yanosea Date: Thu, 10 Oct 2024 23:50:18 +0900 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9Efix:=20fix=20random=20index=20selec?= =?UTF-8?q?tion=20for=20prefix=20and=20suffix=20words?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Corrected the random index selection logic for prefix and suffix wordsin the function `getJrps` in `Generator`. This ensures the correct word lists are used for generating random words. --- app/library/generator/generator.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/library/generator/generator.go b/app/library/generator/generator.go index c587750..776c4d5 100644 --- a/app/library/generator/generator.go +++ b/app/library/generator/generator.go @@ -113,9 +113,9 @@ func (g *Generator) getJrps(num int, argSuffix = "" case WithPrefix: // get random number for suffix - randomIndexSuffix := g.RandProxy.Intn(len(allAVWords)) + randomIndexSuffix := g.RandProxy.Intn(len(allNWords)) // get random prefix word - randomSuffix := allAVWords[randomIndexSuffix] + randomSuffix := allNWords[randomIndexSuffix] // set prefix word and suffix word prefixWord = argPrefix suffixWord = randomSuffix.Lemma.FieldNullString.String @@ -123,9 +123,9 @@ func (g *Generator) getJrps(num int, argSuffix = "" case WithSuffix: // get random number for argPrefix - randomIndexPrefix := g.RandProxy.Intn(len(allNWords)) + randomIndexPrefix := g.RandProxy.Intn(len(allAVWords)) // get random prefix word - randomPrefix := allNWords[randomIndexPrefix] + randomPrefix := allAVWords[randomIndexPrefix] // set prefix word and suffix word prefixWord = randomPrefix.Lemma.FieldNullString.String suffixWord = argSuffix