RosettaCodeData/Task/Linear-congruential-generator/PL-I/linear-congruential-generator.pli
Ingy döt Net d066446780 langs a-z
2013-04-10 22:43:41 -07:00

28 lines
696 B
Text

(nofixedoverflow, nosize):
LCG: procedure options (main);
declare i fixed binary;
put skip list ('BSD', 'MS');
do i = 1 to 20;
put skip list (BSD(), MS());
end;
bsd: procedure returns (fixed binary (31));
declare const fixed binary static initial (12345);
declare s fixed binary (31) static initial (123456789);
s = s * 1103515245 + const;
s = isrl(isll(s,1), 1);
return (s);
end bsd;
ms: procedure returns (fixed binary (15));
declare const fixed binary (31) static initial (2531011);
declare s fixed binary (31) static initial (123456789);
s = s * 214013 + const;
s = isrl(isll(s,1), 1);
return (isrl(s,16));
end ms;
end LCG;