Hi! I have questions, because I write plugin on the drop items with stone, but I dont know how make %. My config: Code: drops: items: diamond: chance: 3.5 You can help me? I want make %..
mt_rand(min, max) returns a pseudo-random integer between min and max inclusively. That means, if you do mt_rand(1, 100), it has a chance to be 1, 2, 3, ..., 99 or 100. Then the chance of it being less than or equal to 0 (<= 0) is 0%. It has 1% chance to be 1, so mt_rand(1, 100) <= 1 has 1% chance to be true. If you check it against 2, it has 2% chance to be true since both outputs of 1 and 2 match the condition. mt_rand(1, 100) <= 99 has 99% chance to be true, because it has 99 numbers that are valid and 1 number that is not valid, hence 99/(99+1) = 99%. mt_rand(1, 100) <= 100 is obviously always true, hence 100%. Now you understand how to do it?