Copyright | (c) Fabricio Olivetti de Franca 2020 |
---|---|
License | GPL-3 |
Maintainer | fabricio.olivetti@gmail.com |
Stability | experimental |
Portability | POSIX |
Safe Haskell | None |
IT.Random
Description
Synopsis
- type Rnd a = State StdGen a
- sampleInterMax :: Int -> Int -> Int -> Int -> Rnd Interaction
- sampleInterMax' :: Int -> Int -> Int -> Int -> Rnd [(Int, Int)]
- sampleInter :: Int -> Int -> Int -> Rnd Interaction
- sampleInter' :: Int -> Int -> Int -> Rnd [(Int, Int)]
- sampleTrans :: [Transformation] -> Rnd Transformation
- sampleTerm :: Rnd Transformation -> Rnd Interaction -> Rnd Term
- sampleExpr :: Rnd Term -> Int -> Rnd Expr
- samplePop :: Int -> Int -> (Int -> Rnd Expr) -> Rnd [Expr]
- sampleTo :: Int -> Rnd Int
- sampleRng :: Int -> Int -> Rnd Int
- sampleNZRng :: Int -> Int -> Rnd Int
- sampleFromList :: [a] -> Rnd a
- toss :: Rnd Bool
Random expressions generation
Arguments
:: Int | problem dimension |
-> Int | maximum number of variables in this interaction |
-> Int | minimum exponent |
-> Int | maximum exponent |
-> Rnd Interaction | Random interaction generator |
Creates a random interaction with up to n variables. Guaranteed to choose at least one variable.
sampleInterMax' :: Int -> Int -> Int -> Int -> Rnd [(Int, Int)] Source #
Arguments
:: Int | problem dimension |
-> Int | minimum exponent |
-> Int | maximum exponent |
-> Rnd Interaction | Random interaction generator |
Sample a random interaction given the problem dimension and the minimum and maximum exponents
sampleInter' :: Int -> Int -> Int -> Rnd [(Int, Int)] Source #
Arguments
:: [Transformation] | choices of transformation functions |
-> Rnd Transformation | Random generator |
Samples a random transformation function from a provided list of functions
Arguments
:: Rnd Transformation | random transformation function |
-> Rnd Interaction | random interaction function |
-> Rnd Term | Random generator |
Samples a random term using a random transformation and a random interaction generators.
Create a random expression with exactly n terms
samplePop :: Int -> Int -> (Int -> Rnd Expr) -> Rnd [Expr] Source #
Create a random population of n expressions with varying number of terms
Utility random functions
sampleNZRng :: Int -> Int -> Rnd Int Source #
Sample from a range of integers excluding 0
sampleFromList :: [a] -> Rnd a Source #
Sample a random element from a list