Copyright © TIBCO Software Inc. All Rights Reserved
Copyright © TIBCO Software Inc. All Rights Reserved


Chapter 3 Tools : RANDOM

RANDOM
Returns a random integer greater than or equal to 1 and less than or equal to the specified limit. (F)
Invocation
number = RANDOM(rangelimit)
 
An integer specifying the largest allowable random number. The rangelimit can be positive or negative if its absolute value is less than or equal to (2**31)-1. Its syntax is B (binary) with length 4.
Usage Notes
If RANDOMSEED is not called, an initial seed is randomly selected.
If 0 is the rangelimit for RANDOM, it substitutes 1.

Exceptions
 
Raised if the absolute value of rangelimit is greater than (2**31)-1
Example
The following rule generates random salaries for a table of test data:

 
GENERATE_DATA;
_
_ ------------------------------------------------------------------------
_ ------------------------------------------------------------+-----------
_ FORALL TEST_EMP_DATA : | 1
_ TEST_EMP_DATA.SALARY = RANDOM(1000); |
_ REPLACE TEST_EMP_DATA; |
_ END; |
_ ------------------------------------------------------------------------

 
Sample Data
If you view the table through the Table Browser after executing this rule, you see a random number in the SALARY field. A sample of the table is shown as follows:

 
BROWSING TABLE : TEST_EMP_DATA
COMMAND ==>
EMPNO LNAME SALARY
_ ------- ---------------------- -------
_ 80000 SMYTHE 964.00
_ 80002 ROTERDAM 109.00
_ 80003 CHANG 34.00
_ 80004 GARZA 909.00
_ 80005 HANSON 779.00
_ 80006 MILMAN 426.00
 
 
 
 
 
 
 
 
 
 
PFKEYS: 1=HELP 5=FIND NEXT 9=RECALL 18=EXCLUDE 13=PRINT 3=END 12=END

 

Copyright © TIBCO Software Inc. All Rights Reserved
Copyright © TIBCO Software Inc. All Rights Reserved