In order to generate numbers, a generator needs one strategy. This encapsulates the algorithm used to get values. There are several of them to choose from in NumGen, but developers can always implement new ones according to their needs.
Based on the superb expression parser
MESP,
FunctionStrategy
can generate numbers after a function, which makes it most
powerful. In fact, other strategies could be considered
obsolete and replaceable by FunctionStrategy; for example,
ConstantStrategy
could be replaced by a function like f(x) = K
, or
RandomStrategy
by f(x) = rand()
. However, these are maintained
for performance reasons (they don't need to call a parser
to interpret a function).
Functions in NumGen can use:
x
, whose value is
the iteration number (i.e. 0 for the first generated
value, 1 for the second one and so on).gen1
and gen2
. Then a new
generator - say gen3
- could use a
function like
gen2(x)/(5*gen1(x+1))
.