• Subject: re: Random Number generator
  • From: Peter Coffin <phcoffin@xxxxxxxxxx>
  • Date: Thu, 18 Dec 1997 12:53:16 -0500

Booth writes:

> I need to generate a random 5-digit number on an AS/400.

The following is adapted from some that I found on one of the magazine
websites, but I can't remember which one... It might be usable if you don't
need something that is *very* random. This is part of a project I'm doing
in idle hours, so it's not something I've even really tested yet.

     C           *ENTRY    PLIST
     C                     PARM           SHTDWN  1
     C                     PARM           SEED    99
     C                     PARM           BGNNBR  60
     C                     PARM           ENDNBR  60
     C                     PARM           RNDNBR  60
     C           SHTDWN    IFEQ 'Y'
     C                     SETON                     LR
     C                     RETRN
     C                     ENDIF
     C           SEED      IFEQ *ZERO
     C                     TIME           TIME   120
     C           TIME      MULT .000000001SEED
     C                     ENDIF
     C           BGNNBR    IFEQ 0
     C           ENDNBR    ANDEQ0
     C           ENDNBR    ORLT BGNNBR
     C                     Z-ADD1         BGNNBR
     C                     Z-ADD999999    ENDNBR
     C                     ENDIF
     C           ENDNBR    SUB  BGNNBR    RANGE   60
     C                     ADD  1         RANGE
     C                     MULT 9821      SEED
     C                     ADD  .211327   SEED
     C           SEED      MULT RANGE     RNDNBR
     C                     ADD  BGNNBR    RNDNBR
     C                     RETRN

Peter H. Coffin
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to "MIDRANGE-L@midrange.com".
| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com

This thread ...

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2019 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].