20.6 Commands at a glance

Following is a list of mathematical support related commands commonly used in simulation scripts:

This creates a new random number generator.

`$rng seed 0 or n`

This command seeds the RNG. If 0 is specified, the RNG is seeded
heuristically. Otherwise the RNG is seeded with the value <n>.

`$rng next-random`

This returns the next random number from RNG.

`$rng uniform a b`

This returns a number uniformly distributed on <a> and <b>.

`$rng integer k`

This returns an integer uniformly distributed on 0 and k-1.

`$rng exponential`

This returns a number that has exponential distribution with average 1.

`set rv [new Randomvariable/type of random-variable]`

This creates an instance of a random variable object that generates random
variables with specific distribution. The different types of random
variables derived from the base class are:

RandomVariable/Uniform, RandomVariable/Exponential, RandomVariable/Pareto,
RandomVariable/Constant, RandomVariable/HyperExponential.
Each of these distribution types are parameterized with values of
appropriate parameters. For details see section 20.2 of this
chapter.

`$rv use-rng rng`

This method is used to associated a random variable object with a
non-default RNG. Otherwise by default, the random variable object is
associated with the default random number generator.