17 lines
299 B
Haskell
17 lines
299 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
|