Rnd Function

Generates a random number.

Rnd ([seed])

Parameters

Seed  -  (Input, expression, Optional)

If a string is passed, it is first converted to numeric form. If a non-numeric value is passed, Error is returned. The random number returned is based on seed:

Return Value

The random number based on the supplied seed value. The return value is a floating-point number, which is always greater than or equal to zero, and less than one.

Examples 

Rnd (-1)

Seed the random number sequence

Round (6 * Rnd()) + 2

Return next random integer between 2 and 8 (inclusive)

Rnd(0)

Return the number just previously generated

Rnd (Null)

Returns same as Rnd()

Rnd (Error)

Returns Error

TIP:

Functions are specifically for use in the Macro Editor. Refer to Microsoft's official VB and JScript documentation for scripting equivalents.

See Also

Functions | Abs function | Atn function | Cos function | Exp function | Fix function | Int function | Log function | Max function | Min function | Rnd function | Round function | Sgn function | Sin function | Sqr function | Tan function


© 2004-2021 looksoftware. All rights reserved.