So I have coded my "final" solution and am testing it.  I used SORT to "count" 
duplicates.  I haven't decided how my personal "goodness" will be done.  The 
less technical a person on the project is the less likely they care.  DIGIT 
means how many zeroes are in the # of elements.  For cpu 2964-N63, running 2.2, 
Cobol 6.2 (OPT(0) program ran last case in 2.19 cpu seconds w/srb= 0.01 sec.  
Wall was 3.9 min.  We have become spoiled.


SEED=12345
DIGIT

elements

unique

.

1

10

7

.

2

100

60

.

3

1000

634

.

4

10,000

6,280

.

5

100,000

63,252

.

6

1,000,000

632,271

.

7

10,000,000

6,329,187

.






-----Original Message-----
From: IBM Mainframe Assembler List [mailto:[email protected]] On 
Behalf Of Paul Gilmartin


On 2017-05-17, at 12:59, Martin Ward wrote:



> On 16/05/17 23:46, Richard Kuebbing wrote:

>> Fantastic.  This looks to be the level of brilliance I was looking

>> for - simplicity plus 100% solution.

>

> To generate a random permutation of the numbers from 1 to 99,999 the

> usual method is the Fisher-Yates shuffle, dating from 1938:

>

> https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle

>

Damn!  So Melvyn and I won't be able to publish our re-discovery.



> This takes O(n) time, as opposed to O(n log n) for Peter's "generate

> and sort" method. With only 99,999 numbers the extra CPU time may not

> be significant, depending on how often you need to generate a

> sequence.

>

Presuming that the table fits in main memory.  On the first mainframes I used, 
99,999 wouldn't have fit.



> There are various statistical tests for randomness, if you don't

> entirely trust your random number generator:

>

> https://en.wikipedia.org/wiki/Randomness_tests

>

And, even worse:

    
https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle#Pseudorandom_generators



    ... a shuffle driven by such a generator cannot possibly produce more

    distinct permutations than the generator has distinct possible states.

    ..., to minimize bias, the number of states of the PRNG should exceed

    the number of permutations by at least several orders of magnitude.



I doubt that any PRNG available nowadays has 99999 ! internal states.

(Probably no one will notice.)



Is DFSORT the Swiss Army Knife of z/OS?



-- gil


----------------------------------------- The information contained in this 
communication (including any attachments hereto) is confidential and is 
intended solely for the personal and confidential use of the individual or 
entity to whom it is addressed. The information may also constitute a legally 
privileged confidential communication. If the reader of this message is not the 
intended recipient or an agent responsible for delivering it to the intended 
recipient, you are hereby notified that you have received this communication in 
error and that any review, dissemination, copying, or unauthorized use of this 
information, or the taking of any action in reliance on the contents of this 
information is strictly prohibited. If you have received this communication in 
error, please notify us immediately by e-mail, and delete the original message. 
Thank you

Reply via email to