We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5eac959 commit b7357a4Copy full SHA for b7357a4
web/components/filters/search.tsx
@@ -82,13 +82,9 @@ export const WORDS: string[] = [
82
"Urban gardening",
83
]
84
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}`;
+function getRandomPair(count = 3): string {
+ const shuffled = [...WORDS].sort(() => 0.5 - Math.random())
+ return shuffled.slice(0, count).join(", ")
92
}
93
94
0 commit comments