serhii.net

In the middle of the desert you can say anything you want

27 Jul 2020

Day 574

Python do something based on probability

python - True or false output based on a probability - Stack Overflow mentions a really neat idea:

def decision(probability):
    return random.random() < probability
Nel mezzo del deserto posso dire tutto quello che voglio.
comments powered by Disqus