Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BiasedCoin ¶
type BiasedCoin struct {
// contains filtered or unexported fields
}
BiasedCoin represents a biased coin. Not 50-50.
func NewBiasedCoin ¶
func NewBiasedCoin(zeroBias int) *BiasedCoin
NewBiasedCoin returns a biased coin for flipping. zeroBias represents the amount of bias towards a zero value. The higher the value of zeroBias the more you will see zeros. a zeroBias of 50 will be a fair coin.
type FairTosser ¶
type FairTosser struct {
// contains filtered or unexported fields
}
FairTosser represents a fair 50-50 coin tosser even if given an unfair coin.
func NewFairTosser ¶
func NewFairTosser(bc *BiasedCoin) *FairTosser
NewFairTosser makes a biased coin fair.
func (*FairTosser) Toss ¶
func (ft *FairTosser) Toss() int
Toss throws the coin and returns 0 or 1 and should be a 50-50 chance.