[Rd] Random number generation

Duncan Murdoch murdoch at stats.uwo.ca
Tue Aug 5 15:10:23 CEST 2008

Please don't cross-post.  This reply is going to R-devel only.

On 8/5/2008 8:47 AM, subramanian R wrote:
> Hi All,
>            I have a few queries regarding Random Number generation in R.
>            according to the help(Random.User) i defined my own functions for

That's help("Random.user")...

> user_unif_rand and user_norm_rand (uniform and normal distribution)
>            But what i figured out was even when i call rexp,rpois,rgeom and
> other distributions they were routed via user_unif_rand.
> 1.  Does this mean that for all types of distribution it generates an
> Uniform distribution and transforms to the requested type?
> Also   surprisingly even rnorm which i hoped to route via user_norm_rand
> was calling user_unif_rand...
>> rnorm(1)
> inside user_unif_rand//printf and
> inside user_unif_rand
> [1] 0.5973648
> Please help me out understanding this...

I think you didn't do things properly, but you didn't show us what you 
did.  When I run the sample code in help("Random.user"), adding an 
Rprintf() call to the user_norm_rand function, I see it being called.

Duncan Murdoch

> 2. Our goal is to link with an vectorized Random number generator library
> for our multi-core architecture.
>     So is it enough if we define user_unif_rand function alone and will it
> take care of all distributions?
> Thanks in Anticipation,
> R. Subramanian
> 	[[alternative HTML version deleted]]
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel

More information about the R-devel mailing list