Solved Probability problem

Discussion in 'Spigot Plugin Development' started by ashStranger, May 6, 2018.

  1. config:
    probability: 80
    if 80%,doing...

    I searched, but there is no good answer.
     
  2. int r = Random.getInt(100) + 1
    if(r <= 80) doing...
     
  3. <= ? Is this 0-80?
    Why not >= ?
     
  4. Depends on what you want. I don't understand why you stucked with this one.
     
  5. because random.getint returns a number between 0-99, adding 1 makes it 1-100. if you do >= 80, thats only 20 numbers.. meaning 20%
     
    • Like Like x 1
    • Agree Agree x 1
  6. <= is less than or equal to.

    >= is greater than or equal to.

    He showed you how to get a random number from 1 to 100. If the number is less than or equal to 80 (which it will, 80% of the time) then do stuff.