The following functions are available, for compatibility with HSPICE.
These functions differ from other math functions in that they take multiple comma-separated arguments, Other math functions internally accept a single argument, but if there are multiple comma-separated terms, they will be collapsed into a single argument through evaluation of the comma operator
a,b = (a + j*b)which yields a complex value. This will not be true in the functions listed below - the comma really means separate arguments in this case.
The first group of functions are equivalent to the HSPICE Monte Carlo functions that are called in .param lines in HSPICE. In WRspice, these are regular math functions.
These functions will return mean values unless enabled. They are enabled while in Monte Carlo analysis, or if the random variable is set, either from the command line or from a .options line in a circuit file.
This returns a vector the same length as nom, complex or real as nom. If the length of rvar is less than the length of nom, rvar is extended by replicating the highest index value of rvar.
If we are not running Monte Carlo analysis, and the random variable is not set, the return vector is the same as nom (no random values are generated). Otherwise the return vector contains uniformly distributed random values, each in the range [nom - nom*rvar, nom + nom*rvar] term-by-term.
Below, random is a pseudo-function that returns a random number between -1 and 1.
This returns a vector the same length as nom, complex or real as nom. If the length of var is less than the length of nom, var is extended by replicating the highest index value of var.
If we are not running Monte Carlo analysis, and the random variable is not set, the return vector is the same as nom (no random values are generated). Otherwise The return vector contains uniformly distributed random values, each in the range [nom - var, nom + var] term-by-term.
Below, random is a pseudo-function that returns a random number between -1 and 1.
This returns a vector the same length as nom, complex or real as nom. If the length of rvar is less than the length of nom, rvar is extended by replicating the highest index value of rvar. Only the zero'th (real) component of sigma is used.
If fewer than three arguments are given, this reverts to the original WRspice gauss function (now called ogauss).
If we are not running Monte Carlo analysis, and the random variable is not set, the return vector is the same as nom (no random values are generated). Otherwise the return vector contains gaussian-distributed random values. The (scalar) sigma value gives the specified sigma of the rvar data, generally 1 or 3.
Below, the pseudo-function gauss returns a gaussian random number with zero mean and unit standard deviation.
This returns a vector the same length as nom, complex or real as nom. If the length of var is less than the length of nom, var is extended by replicating the highest index value of var. Only the zero'th (real) component of sigma is used.
If we are not running Monte Carlo analysis, and the random variable is not set, the return vector is the same as nom (no random values are generated). Otherwise the return vector contains gaussian-distributed random values. The (scalar) sigma value gives the specified sigma of the var data, generally 1 or 3.
Below, the pseudo-function gauss returns a gaussian random number with zero mean and unit standard deviation.
This returns a vector the same length as nom, complex or real as nom. If the length of var is less than the length of nom, var is extended by replicating the highest index value of var.
If we are not running Monte Carlo analysis, and the random variable is not set, the return vector is the same as nom (no random values are generated). Otherwise the return vector contains either nom + var or nom - var determined randomly, term-by-term.
The remaining functions are for HSPICE compatibility, but are not exclusive to the HSPICE Monte Carlo analysis. These also have multiple arguments.
This returns a vector containing xy computed using complex values, term-by-term, however if y is real, is is truncated to an integer value.