From b7357a454649259fa99332ee8b0cb4b9d8fa5736 Mon Sep 17 00:00:00 2001 From: MartinBraquet Date: Wed, 17 Sep 2025 15:25:27 +0200 Subject: [PATCH] Set 3 words --- web/components/filters/search.tsx | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/web/components/filters/search.tsx b/web/components/filters/search.tsx index 8b8d547d..2ccc84fa 100644 --- a/web/components/filters/search.tsx +++ b/web/components/filters/search.tsx @@ -82,13 +82,9 @@ export const WORDS: string[] = [ "Urban gardening", ] -function getRandomPair(): string { - let [first, second] = ['', '']; - while (!first || !second || first === second) { - first = WORDS[Math.floor(Math.random() * WORDS.length)]; - second = WORDS[Math.floor(Math.random() * WORDS.length)]; - } - return `${first}, ${second}`; +function getRandomPair(count = 3): string { + const shuffled = [...WORDS].sort(() => 0.5 - Math.random()) + return shuffled.slice(0, count).join(", ") }