Consultor Eletrônico



Kbase P11842: How to generate RANDOM numbers ?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   29/01/2003
Status: Unverified

GOAL:

How to generate RANDOM numbers ?

FIX:

Random numbers can be generated using the function RANDOM().

If you use the Progress RANDOM function, you get the same "random"
numbers in different sessions. For example, the following program
will always deliver the sequence beginning with 9,14,10,15,14...

DEFINE VARIABLE i AS INTEGER.

DO i = 1 TO 20:
DISPLAY RANDOM(1,20).
DOWN.
END.

(The sequence may vary by platform, but it is repeatable on each
platform).

This is not acceptable in some random number applications.
Since Progress version 7, you may set the -rand startup option to 2, using this option you will get a more truly random result, such that it will be different for different sessions.