module Htirage.Draw where
import Data.Bool
import Prelude (Integer, Integral(..), Num(..))
import Data.List (length, map)
import Htirage.Bits
import Htirage.Combin
import Htirage.Sequence
unorderedDraw :: Integer -> [a] -> [Bool] -> [a]
unorderedDraw k xs bs = map fromInteger (combinOfRank n k r) `permute` xs
where n = toInteger (length xs)
r = randomIntegerOfBits (n`nCk`k) bs
orderedDraw :: Integer -> [a] -> [Bool] -> [a]
orderedDraw k xs bs = map fromInteger (sequenceOfRank n k r) `permute` xs
where n = toInteger (length xs)
r = randomIntegerOfBits (n`nAk`k) bs