Next: randome, Previous: randomb, Up: Internal Routines [Contents][Index]
randomd( [seed=seed,] distribution, dimensions)
Returns a long
array with the specified dimensions
,
which may be a set of integer arguments, or a single integer array. The
returned array is filled with integers between 0
and
num_elem(distribution) - 1
(inclusive) that are drawn at
random according to the distribution function given by
distribution
. The elements of the distribution function
must be monotonically increasing, i.e., no element may be smaller than
the preceding element. Also, we must have distribution(0)
greater than or equal to zero, and distribution(*-1)
equal to
1
. The probability that a particular returned number is equal to
x
is given by differ(distribution,0,1)
(if
distribution
is a one-dimensional array).
seed
specifies a seed for the random numbers, and must be
non-zero. The same seed generates the same sequence of pseudo-random
numbers every time. Different seeds generate different sequences.
See also: random, Random Arrays