I need to create a formula that takes in account percentage probability of something happening.

So it’s like

self.chance = 20

After that I need to have a 20 percent chance of calling a function.

How would I go about doing this? Because I’ve tried with math.randoms and Rand’s but it does not really work as I wanted it to.