LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (January 2002, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
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;


Back to: Top of message | Previous page | Main SAS-L page