You know that in Murder games, there are usually chances of being the murderer. This number changes for every person in the game.
For example, a server has 3 people, the first one gets 50% chance and the other 2 will get 25% chance. And in bigger server, the numbers would be much more complicated than that.
But you can't just do that normally with math.random, it's a very complex system, but it would turns out very well in games. So how do you make it?

6 comments
math
maffs?
But only when they are equal. If one chance is greater than the other, you must also handle that; in your system greatest values are in negative form.
Not sure what I was even saying, you don't need to randomly sort at all. This would work, I'm not sure what you're getting at. 5% of the time, a random integer generated between 1 and 100 will be 25-30, the same chance for it to be 30-35, et cetera.
You do not understand, the RandomPercentage is not the issue. It is a simple line of code. When you assemble bits & pieces together you make something entirely new.
You're not making any sense. Once the random percentage is <= 0 the chance is the one we want to select.