sheet-parser-hs/lib/DND/Dice.hs

17 lines
289 B
Haskell

module DND.Dice
( rolls
, d20
, advantage
) where
import System.Random
rolls :: RandomGen a => Int -> Int -> a -> [Int]
rolls x y = take x . randomRs (1, y)
d20 :: RandomGen a => a -> Int
d20 = minimum . rolls 1 20
advantage :: RandomGen a => a -> Int
advantage = maximum . rolls 2 20