Scrapbook-0.4.0: code examples
Copyright© Frank Jung 2020
LicenseGPL-3
Safe HaskellSafe-Inferred
LanguageHaskell2010

Random

Description

Exploration of the use of Random inspired by Haskell Design Patterns by Ryan Lemmer

Example

Simulate roll a fair 6-sided dice n times.

With a seed of 111111 then we expect [4,6,5,3,2].

Synopsis

Documentation

dice :: (Int, Int) Source #

Range for a 6-sided dice.

roll :: Int -> IO [Int] Source #

Return n rolls of the dice using the system random generator.

rolls :: StdGen -> [Int] Source #

Produce an infinite stream of dice rolls.

seed :: Int -> StdGen Source #

Seed the dice's random generator.