From: Uno on
robin wrote:
> "geo" <gmarsaglia(a)gmail.com> wrote in message news:a82cebe3-cdb9-48af-8080-bca935eeb9b1(a)l14g2000yql.googlegroups.com...
> |I have been asked to recommend an RNG
> | (Random Number Generator) that ranks
> | at or near the top in all of the categories:
> | performance on tests of randomness,
> | length of period, simplicity and speed.
> | The most important measure, of course, is
> | performance on extensive tests of randomness, and for
> | those that perform well, selection may well depend
> | on those other measures.
>
> I have already posted a PL/I version using unsigned arithmetic.
>
> Here is another version, this time using signed arithmetic :--
>
> (NOSIZE, NOFOFL):
> RNG: PROCEDURE OPTIONS (MAIN, REORDER);
>
> declare (xs initial (521288629), xcng initial (362436069),
> Q(0:4690) ) static fixed binary (31);
>
> MWC: procedure () returns (fixed binary (31));
> declare (t,x,i) fixed binary (31);
> declare (c initial (0), j initial (4691) ) fixed binary (31) static;
> declare (t1, t2, t3) fixed binary (31);
>
> if j < hbound(Q,1) then j = j + 1; else j = 0;
> x = Q(j);
> t = isll(x,13)+c+x;
> t1 = iand(x, 3) - iand(t, 3);
> t2 = isrl(x, 2) - isrl(t, 2);
> if t2 = 0 then t2 = t1;
> if t2 > 0 then t3 = 1; else t3 = 0;
> c = t3 + isrl(x, 19);
> Q(j)=t;
> return (t);
> end MWC;
>
> CNG: procedure returns (fixed binary (31));
> xcng=bin(69069)*xcng+bin(123);
> return (xcng);
> end CNG;
>
> XXS: procedure returns (fixed binary (31));
> xs = ieor (xs, isll(xs, 13) );
> xs = ieor (xs, isrl(xs, 17) );
> xs = ieor (xs, isll(xs, 5) );
> return (xs);
> end XXS;
>
> KISS: procedure returns (fixed binary (31));
> return ( MWC()+CNG+XXS );
> end KISS;
>
> declare (i,x) fixed binary (31);
> declare y fixed decimal (11);
>
> Q = CNG+XXS; /* Initialize. */
> do i = 1 to 1000000000; x=MWC(); end;
> put skip edit (" Expected MWC result = 3740121002", 'computed =', x)
> (a, skip, x(12), a, f(11));
> y = iand(x, 2147483647);
> if x < 0 then y = y + 2147483648;
> put skip edit (y) (x(11), f(22)); put skip;
> do i = 1 to 1000000000; x=KISS; end;
> put skip edit ("Expected KISS result = 2224631993", 'computed =', x)
> (a, skip, x(12), a, f(11));
> y = iand(x, 2147483647);
> if x < 0 then y = y + 2147483648;
> put skip edit (y) (x(11), f(22));
>
> end RNG;
>
>

If you were to comment out the PL/I command line that compiled this,
what would it be?
--
Uno
From: robin on
"Uno" <merrilljensen(a)q.com> wrote in message news:8bfos5FakcU1(a)mid.individual.net...
| robin wrote:

| > I have already posted a PL/I version using unsigned arithmetic.
| >
| > Here is another version, this time using signed arithmetic :--
| >
| > (NOSIZE, NOFOFL):
| > RNG: PROCEDURE OPTIONS (MAIN, REORDER);
| >
| > declare (xs initial (521288629), xcng initial (362436069),
| > Q(0:4690) ) static fixed binary (31);
| >
| > MWC: procedure () returns (fixed binary (31));
| > declare (t,x,i) fixed binary (31);
| > declare (c initial (0), j initial (4691) ) fixed binary (31) static;
| > declare (t1, t2, t3) fixed binary (31);
| >
| > if j < hbound(Q,1) then j = j + 1; else j = 0;
| > x = Q(j);
| > t = isll(x,13)+c+x;
| > t1 = iand(x, 3) - iand(t, 3);
| > t2 = isrl(x, 2) - isrl(t, 2);
| > if t2 = 0 then t2 = t1;
| > if t2 > 0 then t3 = 1; else t3 = 0;
| > c = t3 + isrl(x, 19);
| > Q(j)=t;
| > return (t);
| > end MWC;
| >
| > CNG: procedure returns (fixed binary (31));
| > xcng=bin(69069)*xcng+bin(123);
| > return (xcng);
| > end CNG;
| >
| > XXS: procedure returns (fixed binary (31));
| > xs = ieor (xs, isll(xs, 13) );
| > xs = ieor (xs, isrl(xs, 17) );
| > xs = ieor (xs, isll(xs, 5) );
| > return (xs);
| > end XXS;
| >
| > KISS: procedure returns (fixed binary (31));
| > return ( MWC()+CNG+XXS );
| > end KISS;
| >
| > declare (i,x) fixed binary (31);
| > declare y fixed decimal (11);
| >
| > Q = CNG+XXS; /* Initialize. */
| > do i = 1 to 1000000000; x=MWC(); end;
| > put skip edit (" Expected MWC result = 3740121002", 'computed =', x)
| > (a, skip, x(12), a, f(11));
| > y = iand(x, 2147483647);
| > if x < 0 then y = y + 2147483648;
| > put skip edit (y) (x(11), f(22)); put skip;
| > do i = 1 to 1000000000; x=KISS; end;
| > put skip edit ("Expected KISS result = 2224631993", 'computed =', x)
| > (a, skip, x(12), a, f(11));
| > y = iand(x, 2147483647);
| > if x < 0 then y = y + 2147483648;
| > put skip edit (y) (x(11), f(22));
| >
| > end RNG;

| If you were to comment out the PL/I command line that compiled this,
| what would it be?

???


From: James Waldby on
On Tue, 03 Aug 2010 20:41:15 +1000, robin wrote:
> "Uno" <merrilljensen> wrote:
[snip code]
>> If you were to comment out the PL/I command line that compiled this,
>> what would it be?
>
> ???

Does that mean you don't understand Uno's question,
or don't know the answer?

In case you don't understand the question, it appears
to be: "What command is used to compile the code?"

--
jiw
From: Dann Corbit on
In article <i39iqp$sg7$1(a)news.eternal-september.org>, no(a)no.no says...
>
> On Tue, 03 Aug 2010 20:41:15 +1000, robin wrote:
> > "Uno" <merrilljensen> wrote:
> [snip code]
> >> If you were to comment out the PL/I command line that compiled this,
> >> what would it be?
> >
> > ???
>
> Does that mean you don't understand Uno's question,
> or don't know the answer?
>
> In case you don't understand the question, it appears
> to be: "What command is used to compile the code?"

It will depend on the operating system.
Probably JCL along the lines of:
// EXEC PL1LFCLG,REGION.PL1L=256K
From: Peter Flass on
Dann Corbit wrote:
> In article <i39iqp$sg7$1(a)news.eternal-september.org>, no(a)no.no says...
>> On Tue, 03 Aug 2010 20:41:15 +1000, robin wrote:
>>> "Uno" <merrilljensen> wrote:
>> [snip code]
>>>> If you were to comment out the PL/I command line that compiled this,
>>>> what would it be?
>>> ???
>> Does that mean you don't understand Uno's question,
>> or don't know the answer?
>>
>> In case you don't understand the question, it appears
>> to be: "What command is used to compile the code?"
>
> It will depend on the operating system.
> Probably JCL along the lines of:
> // EXEC PL1LFCLG,REGION.PL1L=256K

or "plic -C" <filename>