day66

package
v0.0.0-...-36687a4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 28, 2020 License: MIT Imports: 2 Imported by: 0

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.

func (*BiasedCoin) Toss

func (bc *BiasedCoin) Toss() int

Toss throws the coin and returns 0 or 1

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL