At the suggestion , did the following:
from random import randint
if randint(0,9) < n:
- charge % ratio, in this case 2, i.e. 20%(0,9)
Here is an example of 10 tests with 1000 calls to the function:
According to the results we see that approximately our conditions are met, we got ~20% some answers, and ~80% of the other. In my case, it suits me.