ExtensionTendency stores data for creating random values where the parameters for the random number generation occur over time.
Though the parameters 'parX' and 'parY' (see *new method below) are gnerally used to describe bounds over time, in certain distributions, these actual parameters may control other aspects of a random distribution. See -cauchyRandAt, -gaussRandAt and -poissonRandAt for more details.
The basic usage of Tendency will be through the -at method. A random value will be calculated according to the state of 'parX' and 'parY' at 'time' for a specific 'dist'.
Below is a listing of distributions with examples and how arguments will map to parameters; n/a means a parameter is not used in a distribution.
Linear distributions:
| distribution | parX | parY | parA | parB | more info |
\uniform | low | high | n/a | n/a | -uniformAt |
\lpRand | low | high | n/a | n/a | -lpRandAt |
\hpRand | low | high | n/a | n/a | -hpRandAt |
\meanRand | low | high | n/a | n/a | -meanRandAt |
Non-linear distributions:
| distribution | parX | parY | parA | parB | more info |
\expRand | low | high | n/a | n/a | -expRandAt |
\exponential | density | n/a | n/a | n/a | -expAt |
\gamma | mode | n/a | n/a | n/a | -gammaAt |
\laplace | dispersion | n/a | n/a | n/a | -laplaceAt |
\alaplace | dispersion | n/a | n/a | n/a | -alaplaceAt |
\hcos | dispersion | n/a | n/a | n/a | -hcosAt |
\logistic | dispersion | n/a | n/a | n/a | -logisticAt |
\poisson | mean | n/a | n/a | n/a | -poissonRandAt |
\arcsin | dispersion | n/a | n/a | n/a | -arcsinAt |
Symmetrical non-linear distributions:
| distribution | parX | parY | parA | parB | more info |
\betaRand | low | high | lowProb | highProb | -betaRandAt |
\cauchy | mean | spread | posOnly | n/a | -cauchyRandAt |
\gauss | dev | mean | n/a | n/a | -gaussRandAt |
Creates a new Tendency object. Any of the values below may be a SimpleNumber, an Env or a Function. If a Function is used, the current time will be passed into the Function.
'parX' may be treated as a 'mean').| parX |
For the most common usage, describes the upper bounds of the distribution. |
| parY |
For the most common usage, describes the upper bounds of the distribution. |
| parA |
For some distributions, the control of a specific parameter. |
| parB |
For some distributions, the control of a specific parameter. |
| defDist |
A default distribution to use. |
a new Tendency
Basic usage of Tendency.
| time |
The time to calculate a random number for. |
| dist |
The distribution to use. If supplied, the *defDist is overridden. |
Calculated value at time provided.
Uniform distribution. Convenience method for .at(time, \uniform).
Lowpass distribution. Convenience method for .at(time, \lpRand).
Highpass distribution. Convenience method for .at(time, \hpRand).
Mean (bandpass) distribution. Convenience method for .at(time, \meanRand).
Exponential distribution. Convenience method for .at(time, \expRand). Note that we need to avoid 0.0.
Exponential distribution. Convenience method for .at(time, \exponential). 'parX' parameter control on density.
Gamma distribution. Convenience method for .at(time, \gamma). 'parX' controls mode or peak.
Laplace distribution. Convenience method for .at(time, \laplace). 'parX' value controls dispersion.
Special case of laplace distribution, creates a gap in the centerv (anti-laplace). Convenience method for .at(time, \alaplace). 'parX' value controls dispersion.
Hyperbolic cosine distribution. Convenience method for .at(time, \hcos). 'parX' value controls dispersion.
Logistic distribution. Convenience method for .at(time, \logistic). 'parX' value controls dispersion.
Poisson distribution. Convenience method for .at(time, \poisson). 'parX' value is the mean of the distribution. This distribution has a discrete histogram (not continuous). It returns always integer values.
Arcsin distribution. Convenience method for .at(time, \arcsin). 'parX' value controls dispersion (spread). Output range is between 0 and this value. Histogram shape is similar to beta with parA=parB=0.5.
Beta distribution. Convenience method for .at(time, \betaRand). This distribution takes two extra parameters parA and parB to describe where the likelihood that a random value will occur near parX (parA) or parY (parB).
Cauchy distribution. Convenience method for .at(time, \cauchy). This distribution has a symmetrical histogram around 0. For this implementation 'parX' controls its dispersion. If parA = 1, only positive values are returned.
Gaussian distribution. Convenience method for .at(time, \gauss). This distribution has a bell-shaped symmetrical histogram. 'parX' is the deviation or width of the bell.
Use this Tendency like a Stream.
'parX' at time
'parY' at time
default distribution
| obj | |
| time |
...
| inval | |
| dist | |
| parA | |
| parB |
...