LambdaHack- A roguelike game engine in early and active development

Safe HaskellNone




A list of items with relative frequencies of appearance.


The Frequency type


uniformFreq :: Text -> [a] -> Frequency aSource

Uniform discrete frequency distribution.

toFreq :: Text -> [(Int, a)] -> Frequency aSource

Takes a name and a list of frequencies and items into the frequency distribution.


scaleFreq :: Show a => Int -> Frequency a -> Frequency aSource

Scale frequecy distribution, multiplying it by a positive integer constant.

renameFreq :: Text -> Frequency a -> Frequency aSource

Change the description of the frequency.

setFreq :: Eq a => Frequency a -> a -> Int -> Frequency aSource

Set frequency of an element.


rollFreq :: Show a => Frequency a -> StdGen -> (a, StdGen)Source

Randomly choose an item according to the distribution.

nullFreq :: Frequency a -> BoolSource

Test if the frequency distribution is empty.

runFrequency :: Frequency a -> [(Int, a)]Source

give acces to raw frequency values

nameFrequency :: Frequency a -> TextSource

short description for debug, etc.