- data Gen a
- runGen :: Gen a -> Depth -> Weights -> StdGen -> a
- randomFromType :: Type a -> Gen a
- oneOf :: [Gen a] -> Gen a
- freq :: [(Int, Gen a)] -> Gen a
- choose :: Random a => (a, a) -> Gen a
- elements :: [a] -> Gen a
- depth :: Gen Depth
- weights :: Gen Weights
- incDepth :: Gen a -> Gen a
- randomReplicate :: Int -> Type a -> Gen [a]
runGen takes a
Gen a, a max depth of the expression, the weights, and
the standard random generator.
Takes a list of pairs (weight, Gen), and choose the Gen based on the weights. To get the frequency of choosing a Gen, sum up all the weights, and choose c between 1 and the total. Now recurse down the list, choosing an item only when c <= weight. If not, subtract the current weight from c.