I'm not sure about keeping it to 4 digits, but here is something you can
use.
01 RAND PIC S9(9) COMP VALUE 0.
01 SEED PIC S9(9) COMP VALUE 0.
CALL INTRINSIC 'RAND1' GIVING SEED.
CALL INTRINSIC 'RAND' USING SEED GIVING RAND
Connie Sellitto <[log in to unmask]> on 07/28/99 11:29:32 AM
Please respond to Connie Sellitto <[log in to unmask]>
To: [log in to unmask]
cc: (bcc: Shawn Gordon/IS/FHM/FHS)
Subject: COBOL Random number generator
Writing in COBOLII on an HP3000 937, I need a routine to generate a 4-digit
random number, either on the fly, or to set up as a table. Any
suggestions?