Advertisement
mikeguylol

AP Computer Science Question 8

May 3rd, 2020
492
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.29 KB | None | 0 0
  1. public int randomNums()
  2. {
  3.  int result = 0;
  4.  int chance = (int) (Math.random() * 100);
  5.  if(chance <= 50) {
  6.   result = 50;
  7.  } else if (chance >= 51 && chance <= 75) {
  8.   result = 25
  9.  } else if (chance >= 76 && chance <= 95) {
  10.   result = 20;
  11.  } else {
  12.   result = 5;
  13.  }
  14.  return result;
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement