Consultor Eletrônico



Kbase P168692: How to generate a 64-bit random number
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   6/24/2010
Status: Unverified

GOAL:

How to generate a 64-bit random number

GOAL:

Can I use the RANDOM function to generate 64 bit integers?

FACT(s) (Environment):

All Supported Operating Systems
OpenEdge 10.1B
OpenEdge 10.1C
OpenEdge 10.2x

FIX:

The RANDOM function was modified when the INT64 datatype was implemented to allow a high range that includes 64 bit integers.

FIX:

Example of code to demonstrate using RANDOM to generate 64 bit integers:

DEFINE VARIABLE i64 AS INT64 NO-UNDO.
DEFINE VARIABLE i AS INTEGER NO-UNDO.
i = EXP(2,31) - 1.
REPEAT ON ERROR UNDO, LEAVE:
i64 = RANDOM(i,545435353534534).
DISPLAY STRING(i64,">>>>>>>>>>>9") FORMAT "X(24)".
END.