# IMSL_CONT_TABLE

The IMSL_CONT_TABLE procedure sets up table to generate pseudorandom numbers from a general continuous distribution.

Note: This routine requires an IDL Analyst license. For more information, contact your Exelis VIS sales or technical support representative.

IMSL_CONT_TABLE sets up a table that IMSL_RAND_GEN_CONT can use to generate pseudorandom deviates from a continuous distribution. The distribution is specified by its cumulative distribution function, which can be supplied either in tabular form in table or by a function f. See the documentation for the routine RAND_GEN_CONT for a description of the method.

## Examples

### Example 1

In this example, IMSL_RAND_GEN_CONT is used to set up a table for generation of beta pseudorandom deviates. The CDF for this distribution is computed by the routine IMSL_BETACDF. The table contains 100 points at which the CDF is evaluated and that are used for interpolation. Notice that two warnings are issued during the computations for this example.

.RUN

FUNCTION cdf, x

return, IMSL_BETACDF(x, 3., 2.)

END

iopt = 0

ndata = 100;

table = FLTARR(100, 5)

x = 0.0;

table(*,0) = FINDGEN(100)/100.

IMSL_CONT_TABLE, 'cdf', iopt, ndata, table

IMSL_RANDOMOPT, Set = 123457

r = IMSL_RAND_GEN_CONT(5, table)

PM, r

0.92079391

0.46412855

0.76678398

0.65357975

0.81706959

## Syntax

IMSL_CONT_TABLE, ( f, iopt, ndata, table [, /DOUBLE] )

## Return Value

None

## Arguments

### f

A scalar string specifying a user-supplied function to compute the cumulative distribution function. The argument to the function is the point at which the distribution function is to be evaluated.

### iopt

Indicator of the extent to which table is initialized prior to calling IMSL_CONT_TABLE.

- 0—IMSL_CONT_TABLE fills the last four columns of table. Input the points at which the CDF is to be evaluated in the first column of table. These must be in ascending order.
- 1—IMSL_CONT_TABLE fills the last three columns of table. The supplied function f is not used and may be a dummy function; instead, the cumulative distribution function is specified in the first two columns of table. The abscissas (in the first column) must be in ascending order and the function must be strictly monotonically increasing.

### ndata

Number of points at which the CDF is evaluated for interpolation. ndata must be greater than or equal to 4.

### table

ndata by 5 table to be used for interpolation of the cumulative distribution function. The first column of table contains abscissas of the cumulative distribution function in ascending order, the second column contains the values of the CDF (which must be strictly increasing), and the remaining columns contain values used in interpolation. The first row of table corresponds to the left limit of the support of the distribution and the last row corresponds to the right limit of the support; that is, table (0, 1) = 0.0 and table(ndata – 1, 1) = 1.0.

## Keywords

### DOUBLE

If present and nonzero, double precision is used.

## Version History

6.4 | Introduced

## See Also

IMSL_RAND_GEN_CONT