0

![]() |
![]() |
Guardián del Foro |
Hola Amigos !!!!
Necesito una rutina, ocx, etc que genere números aleatorios de 3, 4 o 5 dígitos
Alguien tiene algo sobre este tema
Saludos !!!!
![]() |
![]() |
Guardián del Foro |
Hola:
Nunca lo probé, pero a lo mejor esta función te sirve.Saludos.RANDOM Function
This function returns a pseudo random value from uniform distributions.
Format
FUNCTION RANDOM [(argument-1)]
Argument
1. The type of argument-1 must be integer.
2. The value of argument-1 must be zero or a positive integer. It is used to
generate a pseudo-random string.
3. The RANDOM function with argument-1 will generate a pseudo-random string
using argument-1 as source.
4. If argument-1 is omitted in the RANDOM function first executed in the run unit, a
pseudo-random string is generated using zero as source.
5. When determining a random value from the same pseudo random string after
execution of the RANDOM function, argument-1 may be omitted. The value of
argument-1 is valid until the next RANDOM function having argument-1 appears.
Function Value
1. The function value is any value in the current pseudo-random string.
2. The range of the function value is:
0 ≤ function value < 1
3. If the value of argument-1 (source value) is the same as in a previous execution,
the same pseudo-random string is used.
Fito...
![]() |
![]() |
Guardián del Foro |
Acá esta la respuesta FITO, me la paso un amigo !!
COBOL Código:
ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. 01 Misc. 05 Pseudo Pic X. 05 Multi-Digit Pic 999999999V9(6). 05 Two-Digit Pic 99999999. 05 Vary Pic 99. 05 hora Pic 99999999. PROCEDURE DIVISION. Return-Pseudo. ACCEPT HORA FROM TIME Compute Multi-Digit = (Function Random (hora)) * 1 Display Two-Digit " VARY" Vary " -----1--> " Multi-Digit " --------> " hora Perform Varying Vary from 1 by 1 Until Vary > 50 Compute Multi-Digit = (Function Random) * 1 Move Multi-Digit to Two-Digit Display Two-Digit " VARY" Vary " --------> " Multi-Digit " --------> " hora End-Perform
Actualmente hay 1 usuarios viendo este tema. (0 miembros y 1 visitantes)
Marcadores