> -----Original Message-----
> From: IBM Mainframe Assembler List [mailto:[email protected]] 
> On Behalf Of Paul Gilmartin
> Sent: Tuesday, May 16, 2017 5:03 PM
> To: [email protected]
> Subject: Re: random quest
>
> > On 2017-05-16, at 14:50, Farley, Peter x23353 wrote:
> >
> > 1.  Use either CEERAN0 or FUNCTION RANDOM to generate a column of 99,999 
> > random numbers.  It's OK if there are duplicates.
> > 2.  Add a second column using SORT with sequential numbers from 1 to 99999 
> > (use the SEQNUM option). 
> > 3.  SORT by the first column only and DO NOT specify the EQUALS option.
> > 4.  Use the numbers in column 2 after sorting as your 99,999 randomly 
> > ordered numbers
> > 
> > You can combine steps 2, 3, and 4 in one SORT execution.  INREC to add the 
> > SEQNUM's as a second column, SORT by first column, OUTREC to select only 
> > the second column for output.

> Are you sure that duplicates in the first column don't matter?

Yes.  The quoted ~30%+ duplicate ratio for the quoted RNG functions seems 
reasonable.

> Consider the wildly unlikely case in which every number selected in the first 
> column is 42.  What is the order in column 2 after the sort?

Highly unlikely using the quoted RNG's.  And even if they all came out as 42 
(another fan of HHGTTG I see), not providing the EQUALS option to SORT allows 
at least the *possibility* that you will get some order other than sequential 
in the output of column 2.  Unlikely I agree, but possible, especially if SORT 
is given only a low amount of memory with which to sort and must use work files 
for partial ordered sequences.

> Well, the statement of the problem didn't require that all permutations be 
> equally likely, so I guess it might not matter.

Exactly.

-- gil

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.

Reply via email to