PoliciesMultiPlayers.with_proba module

Simply defines a function with_proba() that is used everywhere.

PoliciesMultiPlayers.with_proba.random() → x in the interval [0, 1).
PoliciesMultiPlayers.with_proba.with_proba(epsilon)[source]

Bernoulli test, with probability \(\varepsilon\), return True, and with probability \(1 - \varepsilon\), return False.

Example:

>>> from random import seed; seed(0)  # reproductible
>>> with_proba(0.5)
False
>>> with_proba(0.9)
True
>>> with_proba(0.1)
False
>>> if with_proba(0.2):
...     print("This happens 20% of the time.")