- randOAFunc
randOAFunc (NAFunc)¶
Works with VSimBase, VSimEM, VSimPD, VSimPA, and VSimVE licenses.
A function that returns a random number based on a user-given random distribution.
randOAFunc Parameters:¶
- seed (non-negative integer, optional)
A seed for Vorpal’s default random number generator (used only if
<NAFunc numberSequence>
is not given). If seed is not given, a seed will be chosen by Vorpal’s random number generator (N.B. this is a pseudo-random seed, not like using the current time for the seed.)
- probDist (code block, required)
<OAFunc probDist>
is an OAFunc (function of one argument, returning a scalar) specifying a probability distribution, including the domain (which describes the range of possible values resulting from this random number generator). An OAFunc ofkind=expression
is the usual choice here.
- maxRelErr (float, optional, default = 1e-2)
The probability distribution will be approximated with a relative error below this level, subject to
maxNumPoints
.
- maxNumPoints (positive integer, optional, default = 40961)
The maximum number of points at which to sample the probability distribution. The number of sample points will be increased, trying to attain
maxRelErr
, up tomaxNumPoints
.
- doComparison (bool, optional, default = false)
For diagnostic purposes only, compare the approximation of the <OAFunc probDist>, printing out (to stdout) how close the approximation is.
- printSampleValues (non-negative integer, optional, default = 0)
For diagnostic purposes only, the number of sample random numbers to be printed (to stdout) so the user can see if they are distributed as desired.
- numberSequence (code block, optional)
<NAFunc numberSequence>
is an NAFunc code block that generates a random number; if not specified, Vorpal’s default random number generator (uniform in [0,1)) will be used to generate the initial random number.Random numbers will be generated with the desired distribution only if
numberSequence
generates a number uniformly in [0,1).Using this code block makes the
seed
option irrelevant.