Rnd function (LotusScript® Language)

Generates a random number greater than 0 and less than 1.

Syntax

Rnd [ ( numExpr ) ]

Elements

numExpr

Any numeric expression.

Return value

The return value is a number of data type Single. The following table shows how Rnd behaves, depending on the sign of numExpr.

Sign of numExpr

Rnd behavior

Positive

Returns the next random number in the sequence of random numbers generated from the value that most recently seeded the random number generator.

Zero ( 0 )

Returns the random number most recently generated.

Negative

The random number generator is seeded again with numExpr. Rnd returns the first number in the sequence generated from that seed value.

Usage

Use Randomize to seed the random number generator before calling Rnd to generate the number.

If you use Randomize with an argument and then repeatedly call Rnd (with no arguments), LotusScript® returns the same sequence of random numbers every time you execute the script. The particular sequence of random numbers generated from a given seed depends on the platform where you are running LotusScript®.

If you use Randomize without an argument, LotusScript® generates a different sequence of numbers each time you execute the script.

You can call the function with no arguments as either Rnd or Rnd( ).

Example