use random word library

This commit is contained in:
Hazel Noack
2025-07-01 12:17:59 +02:00
parent ad286d745f
commit a1d2669dad
7 changed files with 16 additions and 74761 deletions

View File

@@ -4,11 +4,11 @@ import (
"net/http"
"gitea.elara.ws/Hazel/hangman/internal/game"
"gitea.elara.ws/Hazel/hangman/internal/words"
"gitea.elara.ws/Hazel/words"
"github.com/labstack/echo/v4"
)
func CreateSession(c echo.Context) error {
s := game.NewSession(words.GetRandomWord())
s := game.NewSession(words.Words.GetRandomWord())
return c.JSON(http.StatusOK, s)
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,11 +0,0 @@
package words
import (
"math/rand/v2"
"strings"
)
func GetRandomWord() string {
// https://stackoverflow.com/a/22876612/16804841
return strings.ToLower(Words[rand.IntN(len(Words))])
}