Index154

8ballcode

Feb 21st, 2019
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.15 KB | None | 0 0
  1. upnext = "Define two arrays with different pools of answers";
  2. commonAnswers = ['Definitely', 'Yes', 'Maybe', 'No', 'Absolutely not'];
  3. rareAnswers = ['Fuck you', 'I was about to ask you the same thing', 'What about you?', 'It shall be so', 'The stars say no but I disagree', 'The stars say yes but I disagree', 'You do not deserve to know about this', 'Some questions are better left unanswered...', 'I wish', 'No but it will change in the future'];
  4.  
  5. upnext = "Generate a random number between 1 and 100";
  6. randomNumber = (Math.round(Math.random() * 99 + 1));
  7.  
  8. upnext = "Determine which answer pool to use based on the number";
  9. if(randomNumber <= 5){
  10. answerPool = rareAnswers;
  11. }else{
  12. answerPool = commonAnswers;
  13. }
  14.  
  15. upnext = "Get a random answer from the selected pool and give the output";
  16. answerPool[Math.floor(Math.random() * (answerPool.length - 1))];
Add Comment
Please, Sign In to add comment