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


Chapter 3 Tools : RANDOMSEED

RANDOMSEED
Sets the starting seed for the random number generator. (C)
Invocation
CALL RANDOMSEED(seed)
 
An integer specifying the seed value. It can take on positive or negative values if the absolute value is less than or equal to (2**31)-1. Its syntax is B (binary) with length 4.
Usage Notes
seed can be 0.
Exceptions
 
Raised if the absolute value of seed is greater than (2**31)-1.
Example
The following rule sets the seed for the random number generator and generates test data for the TEST_EMP_DATA table:

 
RULE EDITOR ===> SCROLL: P
GENERATE_DATA(SEED_NUMBER);
_
_ ---------------------------------------------------------------------------
_ ------------------------------------------------------------+--------------
_ CALL RANDOMSEED(SEED_NUMBER); | 1
_ FORALL TEST_EMP_DATA : | 2
_ TEST_EMP_DATA.SALARY = RANDOM(1000); |
_ REPLACE TEST_EMP_DATA; |
_ END; |
_ ---------------------------------------------------------------------------

 
Sample Data
If you execute this rule and give it a number as an argument, you see random numbers in the SALARY field when you browse the table with the Table Browser. You see the same random salaries if you execute the rule again with the same number as an argument. A sample of the table is shown as follows:

 
BROWSING TABLE : TEST_EMP_DATA
COMMAND ==>
EMPNO LNAME SALARY
_ ------- ---------------------- -------
_ 80000 SMYTHE 156.00
_ 80002 ROTERDAM 750.00
_ 80003 CHANG 47.00
_ 80004 GARZA 60.00
_ 80005 HANSON 648.00
_ 80006 MILMAN 773.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