× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.


  • 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.

.....CL0N01N02N03Factor1+++OpcdeFactor2+++ResultLenDHHiLoEqComments+++++++......
     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
phcoffin@us.ibm.com
+---
| 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
+---


As an Amazon Associate we earn from qualifying purchases.

This thread ...


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

This mailing list archive is Copyright 1997-2024 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].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.