From: Leif Svalgaard <email@example.com> > The following code will work on any COBOL compiler: > start by putting a SEED value in RANDOM-SEED. This could be time of day > or anything else you like. Then each time you PERFORM RANDOM-FUNCTION > the data-item RANDOM-RESULT will contain a new pseudo-random value > between 0 and 1. To get an integer X between 1 and 47 (say): > COMPUTE X = RANDOM-RESULT * 47 + 0.5 > you should actually use ROUNDED to get a correct result: COMPUTE X ROUNDED = RANDOM-RESULT * 47 + 0.5 HTH Leif
As an Amazon Associate we earn from qualifying purchases.
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.