The random modifier marks a def pure function as a pseudo-random generator,
allowing it to call other random functions. The modifier appears between def
and pure.
Example
def random pure twoPoisson(a: number, b: number) with
return random.poisson(a) + random.poisson(b)
montecarlo 10000 with
x = twoPoisson(2, 3)
sample avgX = avg(x)
show scalar "Average" with avgX
This outputs the following scalar:
Average
5.0269
def random pure myAdd(a: number) with
return a + random.uniform(1, 2)
table T = extend.range(3)
T.X = myAdd(10 into T)
show table "Random add" with
T.N
T.X
This outputs a table similar to:
N
X
1
11.54774
2
11.51926
3
11.89495
Remarks
This keyword cannot be applied to def process functions.