WeightedCoin
A biased coin that lands heads (true) with the given probability.
Useful for simulating Bernoulli trials with a specific success probability.
Example:
val coin = WeightedCoin(0.7)
coin.flip() // true with 70% probabilityContent copied to clipboard
Parameters
probability
the probability of heads (true). Must be in 0, 1.
random
the random number generator. Defaults to Random.