[R] About function "unif_rand()"

Liaw, Andy andy_liaw at merck.com
Wed Jun 16 00:33:24 CEST 2004


What sort of "random uniform numbers" do you want to generate?  Without
qualifiers, "uniform" usually just refer to U(0,1).  If you want the
interval to be (a, b), just do

X = unif_rand() * (b-a) + a

Andy

> From: xt_wang at cs.concordia.ca
> 
> hello, everybody,
> 
> I met a problem that I want to generate a random uniform 
> number by using 
> function with c interface. 
> 
> What I found is only "unif_rand()", but its range is [0,1]. 
> How can I create a 
> uniform random variable by using a function with c interface.
> 
> Who can tell me what function it is and how to use?
> 
> I will appreciate for it very much.
> 
> Thanks in advance!
> 
> xiaotong wang
> 
>




More information about the R-help mailing list