Date: Mon, 21 Jan 2002 14:17:03 -0500
Reply-To: Gerhard Hellriegel <ghellrieg@T-ONLINE.DE>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Gerhard Hellriegel <ghellrieg@T-ONLINE.DE>
Subject: Re: Random Number Range
On Mon, 21 Jan 2002 12:41:04 -0600, Thomas Allen Schmitt
<schmitta@CSD.UWM.EDU> wrote:
>Hi All! Could someone please tell me how to pull a random number from a
>uniform distribution between a specified range. For example, pull a
>random number from a uniform distribution between 3.76 and 3.88. Thanks!
>
>Tom
One idea: build the difference:
3.88-3.76=??
The random functions return numbers between 0 and 1 as far as I remember -
this ??-range you have to distribute over the 0-1 range and add the lower
limit:
data test;
l0=3.76;
l1=3.88;
d=l1-l0;
do i=1 to 100;
x=d*ranuni(5)+l0;
put x=;
end;
run;