I'm glad to hear that my suggestion was helpful.  Now for the real question 
nobody has yet asked, why?  What interesting problem are you trying to solve 
with these restrictions?  Knowing that may reveal more and better solutions.

--
 
Donald Grinsell, Systems Programmer
Enterprise Technology Services Bureau
SITSD/Montana Department of Administration
406.444.2983 (D)


"Money is not freedom.  A frontal lobotomy - that's freedom."
~ James Lapine

> -----Original Message-----
> From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] On
> Behalf Of Farley, Peter x23353
> Sent: Monday, December 11, 2017 5:52 PM
> To: IBM-MAIN@LISTSERV.UA.EDU
> Subject: Re: Random number generation in a fixed range via utility program(s)
> only?
> 
> Don, that would actually be easy to do and will work well, thank you.  Didn't
> occur to me at first but in hindsight it's quite obvious.
> 
> Peter
> 
> -----Original Message-----
> From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] On
> Behalf Of Grinsell, Don
> Sent: Monday, December 11, 2017 5:33 PM
> To: IBM-MAIN@LISTSERV.UA.EDU
> Subject: Re: Random number generation in a fixed range via utility program(s)
> only?
> 
> Can you generate two numbers?  For every sequential number 1-8000 generate a
> random number to use as a sort key.  Sort on the random key and the
> sequential numbers should get jumbled up just fine.  Shouldn't really matter
> if the random numbers repeat.  I can't say exactly how you would actually do
> that with just the utility programs.  Regards.
> 
> > -----Original Message-----
> > From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU]
> > On Behalf Of Farley, Peter x23353
> > Sent: Monday, December 11, 2017 3:08 PM
> > To: IBM-MAIN@LISTSERV.UA.EDU
> > Subject: Random number generation in a fixed range via utility
> > program(s) only?
> >
> > Is it possible to do the following using only utility programs and
> > control statements?  (z/OS Unix solutions also welcome)
> >
> > Task:      Generate 8-digit zoned-decimal numbers from 1 to some limit
> (e.g.,
> > 1 to 8000) in pseudo-random order with exactly one occurrence of each
> > number in the range in the final output, with no gaps (no numbers not
> > present at
> > all) and no repeats (no duplicate numbers).
> >
> > I know that IEBDG can generate random binary integers 4 bytes long,
> > which certainly SORT can then post-process to convert the random
> > binary values to zoned-decimal values, but it does not seem to be
> > possible to confine the generated random numbers to a specific range.
> >
> > I do not see any "modulus" operation available in the SORT manual, so
> > it apparently isn't possible to post-process the IEBDG numbers with
> > SORT to convert each of the random numbers modulo the limit value.  I
> > suppose division and truncation and subtraction may work, though I
> > haven't figured out how yet.
> >
> > The other hard problem is to guarantee that there is exactly one
> > occurrence of each number and that no numbers in the range are left out.
> >
> > This task is trivially possible with a fairly simple Rexx program of
> > course, or with any other HLL programming or scripting language that
> > you may choose to use that has a RANDOM function of some kind, but it
> > does not seem to be possible using only "utility" programs and control
> > statements as far as I can tell.
> >
> > Does anyone else have better ideas?  Are there z/OS Unix utility
> > programs that can do the job of which I am not aware?
> >
> > If I already have a file of sequentially-numbered records, is there a
> > way to "unsort" them into pseudo-random order?
> >
> > Peter
> --
> 
> This message and any attachments are intended only for the use of the
> addressee and may contain information that is privileged and confidential. If
> the reader of the message is not the intended recipient or an authorized
> representative of the intended recipient, you are hereby notified that any
> dissemination of this communication is strictly prohibited. If you have
> received this communication in error, please notify us immediately by e-mail
> and delete the message and any attachments from your system.
> 
> ----------------------------------------------------------------------
> For IBM-MAIN subscribe / signoff / archive access instructions, send email to
> lists...@listserv.ua.edu with the message: INFO IBM-MAIN

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Reply via email to