Home
Manual
Packages
Global Index
Keywords
Quick Reference

functions in random.i  r
random_ipq

random_ipq(ipq_model, dimlist)
returns an array of double values with the given DIMLIST (see array
function, nil for a scalar result). The numbers are distributed
according to a piecewise linear function (possibly with power law
or exponential tails) specified by the IPQ_MODEL. The "IPQ" stands
for "inverse piecewise quadratic", which the type of function
required to transform a uniform random deviate into the piecewise
linear distribution. Use the ipq_setup function to compute
IPQ_MODEL.
interpreted function, defined at i/random.i line 178

SEE ALSO:

random,
random_x,
random_u,
random_n,
random_rej,
ipq_setup

random_n

random_n(dimlist)
returns an array of normally distributed random double values with
the given DIMLIST (see array function, nil for a scalar result).
The mean is 0.0 and the standard deviation is 1.0.
The algorithm follows the BoxMuller method (see Numerical Recipes
by Press et al.).
interpreted function, defined at i/random.i line 129

SEE ALSO:

random,
random_x,
random_u,
random_ipq,
random_rej

random_rej

random_rej(target_dist, ipq_model, dimlist)
or random_rej(target_dist, bounding_dist, bounding_rand, dimlist)
returns an array of double values with the given DIMLIST (see array
function, nil for a scalar result). The numbers are distributed
according to the TARGET_DIST function:
func target_dist(x)
returning u(x)>=0 of same number and dimensionality as x, normalized
so that the integral of target_dist(x) from infinity to +infinity
is 1.0. The BOUNDING_DIST function must have the same calling
sequence as TARGET_DIST:
func bounding_dist(x)
returning b(x)>=u(x) everywhere. Since u(x) is normalized, the
integral of b(x) must be >=1.0. Finally, BOUNDING_RAND is a
function which converts an array of uniformly distributed random
numbers on (0,1)  as returned by random  into an array
distributed according to BOUNDING_DIST:
func bounding_rand(uniform_x_01)
Mathematically, BOUNDING_RAND is the inverse of the integral of
BOUNDING_DIST from infinity to x, with its input scaled to (0,1).
If BOUNDING_DIST is not a function, then it must be an IPQ_MODEL
returned by the ipq_setup function. In this case BOUNDING_RAND is
omitted  ipq_compute will be used automatically.
interpreted function, defined at i/random.i line 198

SEE ALSO:

random,
random_x,
random_u,
random_n,
random_ipq,
ipq_setup

random_u

random_u(a, b, dimlist)
return uniformly distributed random numbers between A and B.
(Will never exactly equal A or B.) The DIMLIST is as for the
array function. Same as (ba)*random(dimlist)+a. If A==0,
you are better off just writing B*random(dimlist).
interpreted function, defined at i/random.i line 112

SEE ALSO:

random,
random_x,
random_n,
random_ipq,
random_rej

random_x

random_x(dimlist)
same as random(DIMLIST), except that random_x calls random
twice at each point, to avoid the defect that random only
can produce about 2.e9 numbers on the interval (0.,1.) (see
random for an explanation of these bins).
You may set random=random_x to get these "better" random
numbers in every call to random.
Unlike random, there is a chance in 1.e15 or so that random_x
may return exactly 1.0 or 0.0 (the latter may not be possible
with IEEE standard arithmetic, while the former apparently is).
Since cosmic rays are far more likely, you may as well not
worry about this. Also, because of rounding errors, some bit
patterns may still be more likely than others, but the 0.5e9
wide bins of random will be absent.
interpreted function, defined at i/random.i line 73

SEE ALSO:

random

