How to use dclgen in Cobol programming

random ()

Sample code

The code generates random numbers and displays them.

Notes and Warnings

If it is important for a sequence of values ​​generated by to be different on subsequent executions of a sketch, use to initialize the random number generator with a fairly random input, e.g. B. on a disconnected pin.

Conversely, it can sometimes be useful to use pseudo-random sequences that repeat exactly. This can be achieved by calling with a fixed number before starting the random sequence.

The max parameter should be selected according to the data type of the variable in which the value is stored. In any case, the absolute maximum is linked to the length of the generated value (32 bit-2,147,483,647). If you set max to a higher value, no error will be generated during compilation. However, during the execution of the sketch, the numbers are not generated as expected.