Random numbers
Author Message
Random numbers

Hi

This is probably a very simple question and I'm not even sure if it belongs
in this ng. If the question is off-topic, I apologize.

Does anyone have an example on how to generate a list of unique random
numbers in PL/I? I want to be able to generate n integers between a and b,
i.e. generate 200 random numbers between 1 and 10000.

I use PL/I under MVS/ESA. I've heard that the PC-version has a random
function, but unfortunately I don't have it.

Sincerely, H?kan M?ller

Mon, 12 Mar 2001 03:00:00 GMT
Random numbers

on Thu, 24 Sep 1998 18:13:32 +0100,

Quote:
>Hi

>This is probably a very simple question and I'm not even sure if it belongs
>in this ng. If the question is off-topic, I apologize.

>Does anyone have an example on how to generate a list of unique random
>numbers in PL/I? I want to be able to generate n integers between a and b,
>i.e. generate 200 random numbers between 1 and 10000.

>I use PL/I under MVS/ESA. I've heard that the PC-version has a random
>function, but unfortunately I don't have it.

>Sincerely, H?kan M?ller

Here's the complete PL/I source code for a (simple) power residue random
number generator, from C.T. Fike's book: "PL/I for Scientific Programmers".
Random:
Proc Returns(Float Bin(21));
Dcl R Fixed Bin(31) Init(452807053) Static;
(Nofofl): R = R*452807053;
Return(R*0.465661e-9);
End;

Random returns a random floating point number (FLOAT BIN(21)) that is
between 0.0 and 1.0; The algorithm only works on S/390 type machines,
but thats no bug deal since you're running MVS on S/390. It should be
easy for you to expand upon this code to make a routine that does
exactly what you want... Enjoy.

Dave Jones

Mon, 12 Mar 2001 03:00:00 GMT

 Page 1 of 1 [ 2 post ]

Relevant Pages