Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
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
Documentation
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
>>>
flipCoin (mkDieGen 143)
(False, {144, rdBoolsPrime})
mkCoinGen :: Int -> CoinGen Source #
Creates a new CoinGen with the given index and the default bool table
Examples
>>>
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
>>>
mkCoinGenCustom 143 [True, False, False, True, True]
{143, [True, False, False, True, True]}>>>
mkCoinGenCustom 143 []
{143, rdBoolsPrime}