The COBOL RANDOM
function documentation doesn't give sufficient information on the range of accepted values for argument-1
.
Perhaps someone can shed light on my following questions:
MOD
function applied to the seed value?In short:
Is there a specification in the COBOL standard defining which digits of a value like 01 myRandomSeed PIC 9(50).
are being used?
For the COBOL standard have a look at the current draft standard (the files available there vary depending on the current state of the committee work), which has the RANDOM
function under "15 intrinsic functions".
The format is:
FUNCTION RANDOM [ ( [ argument-1 ] ) ]
With the rules that the optional argument-1 shall be of class numeric and either be zero or a positive integer.
For the returned value:
The implementor shall specify the subset of the domain of argument-1 values that will yield distinct sequences of pseudo-random numbers. This subset shall include the values from 0 through at least 32767.