Skip to content

Commit b7357a4

Browse files
committed
Set 3 words
1 parent 5eac959 commit b7357a4

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

web/components/filters/search.tsx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,9 @@ export const WORDS: string[] = [
8282
"Urban gardening",
8383
]
8484

85-
function getRandomPair(): string {
86-
let [first, second] = ['', ''];
87-
while (!first || !second || first === second) {
88-
first = WORDS[Math.floor(Math.random() * WORDS.length)];
89-
second = WORDS[Math.floor(Math.random() * WORDS.length)];
90-
}
91-
return `${first}, ${second}`;
85+
function getRandomPair(count = 3): string {
86+
const shuffled = [...WORDS].sort(() => 0.5 - Math.random())
87+
return shuffled.slice(0, count).join(", ")
9288
}
9389

9490

0 commit comments

Comments
 (0)