RndExpN Random Type (exponential distribution)

Action

Declares a random variable of type RndExpN. With each access, such a variable contains a random integer value that is generated following an exponential distribution. The floating-point values of the exponential distribution are rounded to integer values (1.5 —>—> 2, 1.4 —>—> 1, ...).

Syntax

RndExpN( l..u: m ): number;

Return value

number

Parameter Description
l Lower boundary of the integer interval of random values (number)
u Upper boundary of the integer interval of random values (number)
m

Mean value of the exponential distribution (float)

Condition: l <= m <= u

If a generated random value is outside the interval of integer values declared, it is replaced by the value of the respective boundary.

Example

dclrand
  rEvent1, rEvent2 : RndBin(0.25);
  rTime1           : RndExpF(5.5);
  rTime2           : RndUniF(0.5..12.5);
  rCube            : RndUniN(1..6);
  rPrice           : RndUniN(10..2000);
  rArtNo           : RndExpN(1..10000: 100.0);
  ...

dclsql
  UpdArticle:
    UPDATE article SET price = :rPrice
    WHERE articlenumber = :rArtNo;

The random variable rArtNo is used in a SQL command to access an article with a random article number of type integer. The generated random integer values follow an exponential distribution with a mean value of 100.0. Values outside the interval 1 to 10000 are replaced by the respective boundary of the interval.

Sample scripts

OraSample.bdf, DBApi01.bdf