Rnd

concerns

The Rnd function returns a random number. Use the Randomize function to create a new random number set.

 

Syntax

Rnd([Value])

Return value

Type

Description

Double

Random number

Parameter

Use

Name

Type

Passing

Description

Optional

Value

Double

ByVal

Mode for random number generation

 

Value

Description

< 0

Always the same number that uses Value as the seed value.

> 0

The next random number in the sequence.

= 0

The last number generated.

Not specified

The next random number in the sequence.

Note

The Rnd function returns a value that is less than 1 but greater than or equal to zero.

Use the following formula to generate integer random numbers within a specific range:

IntNumber((upper limit - lower limit + 1) * Rnd + lower limit)

The upper limit here is the largest number of the range and the lower limit is the smallest number of the range.