Publication date: 08/13/2020

# Random Functions

You can create formulas that generate random numbers by effectively “rolling the dice” within the constraints of the specified distribution. Each time you click Apply in the Formula Editor window, these functions produce a new set of random numbers.

Note: Random numbers are generated using the Mersenne-Twister technique. This technique has a period length of 219937-1. For more information about the generators, see Matsumoto and Nishimura (1998). The new generators are verified to pass all the DIEHARD tests as documented in Marshalled (1996).

See Random Functions in the JSL Syntax Reference for more information about distribution parameterizations and function arguments.

#### Random ChiSquare

Generates a column of random numbers from a Chi-Square distribution with specified degrees of freedom. The optional noncentrality parameter must be greater than or equal to 0. The noncentrality parameter is 0 by default.

#### Random F

Generates a column of random numbers from an F distribution with specified numerator degrees of freedom and denominator degrees of freedom. The optional noncentrality parameter must be greater than or equal to 0. The noncentrality parameter is 0 by default.

#### Random Index

Returns a k by 1 matrix of random integers between 1 and n with no duplicates.

#### Random Uniform

Generates a column of random numbers from a uniform distribution. If no arguments are specified, the minimum of the uniform distribution is 0 and the maximum is 1. This means that any number between 0 and 1 is as likely to be generated as any other. The result is an approximately even distribution. You can use the optional arguments to specify different values for the minimum and maximum numbers of the uniform distribution.

#### Random Normal

Generates a column of random numbers from a normal distribution with specified mean and standard deviation. If no arguments are specified, the normal distribution has mean of 0 and standard deviation of 1.

#### Random Normal Mixture

Returns a random number from a normal mixture distribution with the specified arguments.For information about the syntax for the Random Normal Mixture function, see JSL Functions in the JSL Syntax Reference.

#### Random Exp

Generates a column of random numbers from an exponential distribution with lambda=1. You can scale the exponential function to use a different lambda. For example, Random Exp()*.1 generates an exponential distribution for lambda=0.1.

#### Random Gamma

Generates a column of random numbers from a gamma distribution with specified shape and scale parameters. The default value of the scale parameter is 1. When the scale parameter is 1, the gamma distribution is equivalent to an exponential distribution.

#### Random GenGamma

Generates a column of random numbers from an extended generalized gamma distribution with specified location, scale, and shape parameters. If no arguments are specified, the generalized gamma distribution has location of 0, scale of 1, and shape of 0.

#### Random LogGenGamma

Generates a column of random numbers from a log generalized gamma distribution with specified location, scale, and shape parameters. If no arguments are specified, the extended generalized gamma distribution has location of 0, scale of 1, and shape of 0.

#### Random Beta

Generates a column of random numbers from a beta distribution with two specified shape parameters and optional threshold and scale parameters. The default threshold is 0, and the default scale is 1.

#### Random Cauchy

Generates a column of random numbers from a Cauchy distribution with location parameter 0 and scale parameter 1. A Cauchy variate with location parameter alpha and scale parameter beta can be generated with the formula alpha+beta*Random Cauchy().

#### Random Category

Generates a column of random category assignments based on a set of probability and result expressions (for example, Random Category(.2, "A", .3, "B", .4, "C", "D");). A random uniform number is generated and compared to the probabilities to determine which result expression is returned.

#### Random Johnson Su

Generates a column of random numbers from a Johnson Su distribution with two specified shape parameters, a location parameter, and a scale parameter.

#### Random Johnson Sb

Generates a column of random numbers from a Johnson Sb distribution with two specified shape parameters, a location parameter, and a scale parameter.

#### Random Johnson Sl

Generates a column of random numbers from a Johnson Sl distribution with two specified shape parameters, a location parameter, and an optional skewness parameter. The skewness parameter can be +1 for positive skew or -1 for negative skew. The default is +1.

#### Random Seed State

Retrieves or restores the random seed state to or from a BLOB object.

#### Random Triangular

Generates a column of random numbers from a triangular distribution with specified minimum, maximum, and mode parameters. If you specify only one argument, it represents the mode and the triangular distribution is between 0 and 1. If you specify two arguments, they represent the mode and the maximum, respectively, and the triangular distribution is between 0 and the maximum. If you specify three arguments, they represent the minimum, the mode, and the maximum, respectively, and the triangular distribution is between the minimum and the maximum.

#### Random Integer

Generates a column of random numbers from a uniform distribution of integers. If you specify one argument, the integers are between 1 and the argument. If you specify two arguments, the integers are between and include the values of the two arguments.

#### Random Binomial

Generates a column of random numbers from a binomial distribution with specified parameters. The first argument is n, the number of trials in a binomial experiment. The second argument is p, the probability that the event of interest occurs. When n is 1, the binomial function generates a distribution of Bernoulli trials.

#### Random Negative Binomial

Generates a column of random numbers from a negative binomial distribution with specified parameters. The first argument is r, the number of successes of interest. The second argument is p, the probability of success. The random variable of interest is the number of failures that precede the rth success. In contrast to the binomial variate, where the number of trials is fixed and the number of successes is variable, the negative binomial variate is for a fixed number of successes and a random number of trials.

#### Random Beta Binomial

Generates a column of random numbers from a beta binomial distribution with specified parameters. The first argument is n, the number of trials. The second argument is p, the probability of success for each trial. The third argument is optional and represents the overdispersion parameter. The default overdispersion parameter is 0.

#### Random Frechet

Generates a column of random numbers from a Fréchet distribution with specified location and scale parameters. If no arguments are specified, the Fréchet distribution has location of 0 and sigma of 1.

#### Random Geometric

Generates a column of random numbers from a geometric distribution with specified probability parameter. The argument is the probability that a specific event occurs at any one trial. The random variable of interest is the number of trials until a specific event occurs for the first time.

#### Random Poisson

Generates a column of random numbers from a Poisson distribution with specified shape parameter.

#### Random Gamma Poisson

Generates a column of random numbers from a gamma Poisson distribution with specified shape and overdispersion parameters. If the second argument is not specified, the gamma Poisson distribution has an overdispersion of 1.

#### Random Weibull

Generates a column of random numbers from a Weibull distribution with specified shape and scale parameters. If the second argument is not specified, the Weibull distribution has scale of 1.

#### Random Logistic

Generates a column of random numbers from a logistic distribution with specified location and scale parameters. If no arguments are specified, the logistic distribution has location of 0 and scale of 1.

#### Random Loglogistic

Generates a column of random numbers from a loglogistic distribution with specified location and scale parameters. If no arguments are specified, the loglogistic distribution has location of 0 and scale of 1.

#### Random Lognormal

Generates a column of random numbers from a lognormal distribution with specified location and scale parameters. If no arguments are specified, the lognormal distribution has location of 0 and scale of 1.

#### Random GLog

Generates a column of random numbers from a generalized logarithmic distribution with specified location, scale, and shape parameters. When the shape parameter is 0, the generalized logarithmic distribution is equivalent to a lognormal distribution.

#### Random Reset

Restarts the random number sequences with a seed that you specify.

#### Random LEV

Generates a column of random numbers from a largest extreme value (LEV) distribution with specified location and scale parameters. If no arguments are specified, the LEV distribution has location of 0 and scale of 1.

#### Random SEV

Generates a column of random numbers from a smallest extreme value (SEV) distribution with specified location and scale parameters. If no arguments are specified, the SEV distribution has location of 0 and scale of 1.

#### Random SHASH

Generates a column of random numbers from a sinh-arcsinh (SHASH) distribution with two specified shape parameters, a location parameter, and a scale parameter.

#### Random Shuffle

Generates a randomly ordered column of numbers from the numbers in the matrix argument.

#### Random t

Generates a column of random numbers from a t distribution with specified degrees of freedom. The optional noncentrality argument may be negative or positive. The noncentrality parameter is 0 by default.

#### Col Shuffle

Selects a row number at random from the current data table. Each row number is selected only once. When Col Shuffle is used as a subscript, it returns a value selected at random from the column that serves as its argument. Each value from the original column is assigned only once as Col Shuffle’s result.For more information about the syntax for the Col Shuffle function, see Random Functions in the JSL Syntax Reference.

#### Resample Freq

Generates a random selection with replacement frequency counts, suitable for use in bootstrapping. For example, it supports a second Freq Column argument, enabling it to do bootstrap samples relating to a pre-existing frequency column specified in the second argument. Resample Freq() generates a 100% resample. ResampleFreq(rate) generates a rate frequency sample. Resample(rate, column) generates a sample that is calculated by the rate multiplied by the sum of the specified column. For more information about the syntax for the Resample Freq function, see Discrete Probability Functions in the JSL Syntax Reference.