RndUniN Random Type (uniform distribution)

Action

Declares a random variable of type RndUniN. With each access, such a variable contains a value that is generated following a uniform distribution. The parameters of the RndUniN function specify the minimum value and the maximum value of the uniform distribution. Within these boundaries all integer values have the same probability (including the boundaries).

Syntax

RndUniN( l..u ): number;

Return value

number

Parameter Description
l Lower boundary (number)
u

Upper boundary (number)

Condition: l <= u

Example

dclrand
  rCube  : RndUniN(1..6);
  rArtNo : RndUniN(1..10000);
  rPrice : RndUniN(10..2000);

dcltrans
  transaction t1
  var
    i: number;
  begin
    for i := 1 to rCube do
      c1: UpdArticle();
    end;
  end t1;

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

rCube is a random variable that generates integer random values between 1 and 6. Each value has the same probability. rCube is used in a for loop of a transaction to express a random factor of repetition. The random variable rArtNo generating integer numbers between 1 and 10000 is used in a SQL command to access an article randomly. The random variable rPrice is used to update the price of the accessed article; the price is set randomly to a value between 10 and 2000.

Sample scripts

OraArrayFetch.bdf, OraSample.bdf, Trans.bdf