DataBasic Reference > Statements and Intrinsic Functions > R > RND Function

Comment on this topic

Documentation Comments

Use this form to comment on this topic. You can also provide any general observations about the Online Documentation, or request that additional information be added in a future release.

Reality V15.0 ()

RND Function (DataBasic) (m618703+rnd_f.htm)

To

Reality

Version

Topic

Submitted by

Company

Location

Email address

Comment

 

 

RND Function

Returns a random number.

Syntax

RND(expression)

Syntax Elements

expression is any valid DataBasic expression that evaluates to a positive integer.

Comments

RND generates a random number between zero and the number specified by expression minus one.

expression must be a positive number. If a negative number is used, it is converted to the absolute value (the program performs an implicit ABS on the input argument).

Examples

Z = RND(11)

Assigns a random number between 0 and 10 (inclusive) to variable Z.

R = 100
Q = 50
B = RND(R+Q+1)

Assigns a random number between 0 and 150 (inclusive) to variable B.

Y = RND(-51)

Assigns a random number between 0 and 50 inclusive to variable Y.

RealityV15.0Comment on this topic