Next: , Previous: , Up: Built-in functions   [Contents][Index]


Random-number functions

Random-number functions

coNCePTuaL programs can utilize randomness in one of two ways. The functions described below are unsynchronized across tasks. That is, they can—and usually do—return a different value to each task on each invocation. One consequence is that these functions are not permitted within a task expression (see Task descriptions) because randomness would cause the tasks to disagree about who the sources and targets of an operation are. In contrast, the A RANDOM TASK construct described in Binding variables returns a value guaranteed to be synchronized across tasks and thereby enables random-task selection.

Function: RANDOM_UNIFORM (lower_bound, upper_bound)

Return a number selected at random from a uniform distribution over the range [lower_bound, upper_bound).

Function: RANDOM_GAUSSIAN (mean, stddev)

Return a number selected at random from a Gaussian distribution with mean mean and standard deviation stddev.

Function: RANDOM_POISSON (mean)

Return an integer selected at random from a Poisson distribution with mean mean and standard deviation sqrt(mean).

Function: RANDOM_PARETO (shape, scale)
Function: RANDOM_PARETO (shape, lower_bound, upper_bound)

With the two-argument form, return an integer selected at random from a Pareto distribution with shape shape and scale scale. With the three-argument form, return an integer selected at random from a bounded Pareto distribution with shape shape and bounded by the range [lower_bound, upper_bound].

Scott Pakin, pakin@lanl.gov