[R] About function "unif_rand()"

Duncan Murdoch dmurdoch at pair.com
Wed Jun 16 01:11:03 CEST 2004

On Tue, 15 Jun 2004 18:17:36 -0400, xt_wang at cs.concordia.ca wrote:

>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?

It's not clear to me what you are asking for.  Do you want it to be
uniform on the range (A,B)?  Use A + (B-A)*unif_rand() or runif(A,B).
These are documented in the Writing R Extensions manual, along with a
large collection of other distributions (and instructions on how to
initialize them).

Duncan Murdoch

More information about the R-help mailing list