Copyright(c) Fabricio Olivetti de Franca 2020
LicenseGPL-3
Maintainerfabricio.olivetti@gmail.com
Stabilityexperimental
PortabilityPOSIX
Safe HaskellNone

IT.Random

Description

 
Synopsis

Random expressions generation

type Rnd a = State StdGen a Source #

The type used for generating random values of a

sampleInterMax Source #

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 #

sampleInter 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 #

sampleTrans Source #

Arguments

:: [Transformation]

choices of transformation functions

-> Rnd Transformation

Random generator

Samples a random transformation function from a provided list of functions

sampleTerm Source #

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.

sampleExpr Source #

Arguments

:: Rnd Term

random term function

-> Int

number of terms

-> Rnd Expr

Random generator

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

sampleTo :: Int -> Rnd Int Source #

sample from [0,n]

sampleRng :: Int -> Int -> Rnd Int Source #

Sample from a range of integers

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

toss :: Rnd Bool Source #

Toss a coin to your Witcher