doc: create getRandomPrompt function
This commit is contained in:
1 parent
2f4f2c470c
commit
ca79396e29
1 file changed
+10
@@ -0,0 +1,10 @@
|
||||
import { surpriseMePrompts } from "../constants";
|
||||
|
||||
export function getRandomPrompt(prompt) {
|
||||
const randomIndex = Math.floor(Math.random() * surpriseMePrompts.length);
|
||||
const randomPrompt = surpriseMePrompts[randomIndex];
|
||||
|
||||
if (randomPrompt === prompt) return getRandomPrompt(prompt);
|
||||
|
||||
return randomPrompt;
|
||||
}
|
||||
Reference in new issue
Block a user