The RANDOM function documentation page doesn't give sufficient information on the range of accepted values for argument-1.
Perhaps someone can shed light on my following two questions:
- What range of seed values is accepted?
- How are values treated that are exceeding the allowed range?
» Are they truncated?
» Are only the lower bits used?
» Or the upper bits?
» Are the leftmost digits used?
» Or the rightmost?
» How many of them?
» Is a `MOD` function applied to the seed value?
It is common to use the current date/time as a seed value for RANDOM to get a "truely pseudo random" sequence. So I used below piece of code to create an appropriate seed value. But I have no clue on how the seed value I'm providing to the RANDOM function is processed by the compiler.
If the compiler only took the first few digits (which is the date part) then this wouldn't result in different random sequence results when the program would be run several times a day. That's not what I'm looking for.
Your answers are appreciated.
------------------------------------
WORKING-STORAGE SECTION.
01 dateTimeString PIC X(16).
01 dateTime PIC 9(16) USAGE IS COMP VALUE ZEROS.
01 vNumber PIC 9(4).
PROCEDURE DIVISION.
*> Create random seed value
MOVE FUNCTION CURRENT-DATE TO dateTimeString
MOVE FUNCTION NUMVAL(dateTimeString) TO dateTime
COMPUTE vNumber = FUNCTION RANDOM(dateTime) * 700
.





