Map and Table Calculation

RND( ) function

Returns a random value.

Syntax

RND()
RND(0)

RND(Value)

Input

Value is a long integer value
Domain type: any Value domain
Value range: >=0

Output

RND() returns: a real value at random
Domain: system domain Value
Value range: [0,1>

 

RND(0) returns: a 0 or a 1 at random
Domain: system domain Value

 

RND(Value) returns: a long integer value
Domain: system domain Value
Value range: [1,Value]

Notes:

Tips:

Usable in

MapCalc, TabCalc, Simple calculators

Examples

Pocket line calculator examples:

? RND()

may return a random value between 0 and 1, e.g. 0.857

? RND(0)

may return a 0 or 1 at random, e.g. 1

? RND(1000)

may return a random integer value between 1 and 1000, e.g. 472

? RND(POW(2,3))

may return a random integer value between 1 and 8, e.g. 4

? RND(6)+RND(6)

simulates the casting of two dice

MapCalc example:

OutMap1 := RND()

OutMap2 := RND(0)

OutMap3 := RND(1000)

 

OutMap1

OutMap2

OutMap3

0.689 0.376 0.725
0.574 0.803 0.245
0.615 0.243 0.157
1 0 0
1 1 0
0 1 1
371 61 992
760 266 142
482 953 674

TabCalc example:

OutCol1 := RND()

OutCol2 := RND(0)

OutCol3 := RND(1000)

 

OutCol1

OutCol2

OutCol3

0.689

1

371

0.376

0

61

0.725

0

992

0.574

1

760

0.803

1

266

0.245

0

142

0.615

0

482

0.243

1

953

0.157

1

674

See also:

ROUND