Functions

randomDecimal

Supported By

Syntax

the randomDecimal

randomDecimal ()

Description

The randomDecimal function returns a random real number between zero, exclusive, and one, inclusive. That is, it is possible for the returned value to be one, but not zero.

Note

Most programming languages have a random number function that returns a number between zero, inclusive, and one, exclusive. That is, it is possible for the function to return zero, but not one. In XION, however, the randomDecimal function can return one, but not zero. For the terminally curious, this is due to the implementation of a randomDecimal function in KHyX, an extension stack for HyperCard; this also reflects the fact that the random function can return the integer passed to it, but cannot return zero. To match the functionality of other languages, you can subtract the value returned from randomDecimal from one.

See Also

random, randomRange