real-dice-0.1.0.5: Random number generation based on physical media touched by humans
Safe HaskellSafe-Inferred
LanguageHaskell2010

RealDice.Coin

Description

This module exports the CoinGen data type and functions for flipping Coins to generate random boolean values via balanced tables randomized by the RealDice data or custom boolean tables

Synopsis

Documentation

data CoinGen Source #

Stores a balanced table of random boolean values and an index pointing to the next value to return

flipCoin :: CoinGen -> (Bool, CoinGen) Source #

Generates a random boolean value via a simple table lookup

Examples

Expand
>>> flipCoin (mkDieGen 143)
(False, {144, rdBoolsPrime})

mkCoinGen :: Int -> CoinGen Source #

Creates a new CoinGen with the given index and the default bool table

Examples

Expand
>>> mkCoinGen 143
{143, rdBoolsPrime}

mkCoinGenCustom :: Int -> [Bool] -> CoinGen Source #

Creates a new CoinGen with the given index and bool table

Defaults to the RealDice balanced table of random booleans if an empty list is given

Examples

Expand
>>> mkCoinGenCustom 143 [True, False, False, True, True]
{143, [True, False, False, True, True]}
>>> mkCoinGenCustom 143 []
{143, rdBoolsPrime}