CCATSL provides three functions for controlling the generation of
pseudo-random numbers. RandomCL returns a
random number distributed uniformly on
,
RandomIntCL returns a random integer
uniformly distributed on the set
for
specified
,
and SetRandomCL allows you to change the
current state of the random number generator, useful if you want to ensure your
program uses the same sequence of random number each time it is run.
RandomCL
|
double u; ... u=RandomCL(); /* get a U[0,1) rv */ |
RandomIntCL
| int RandomIntCL ( |
int n); |
| n |
The size of the set |
SetRandomCL
| void SetRandomCL ( |
int seed); |
| seed |
If seed>0, this will set the seed for subsequent random number
generations. If seed<0, the random number generator will be
seeded using a number derived from the current time. Used this way,
we can ensure that successive runs of a program use independent
sequences of random numbers. |