Skip to content
Back to formatted view

Raw Message

Message-ID: <4580095A.6010508@stats.uwo.ca>
Date: 2006-12-13T14:08:26Z
From: Duncan Murdoch
Subject: R_Code
In-Reply-To: <20061212163929.178510@gmx.net>

On 12/12/2006 11:39 AM, Ilka Schmidt wrote:
> Hello!
> 
> I need the Code of the functions runif and rexp. Where can I get them? Can You help me? 
> 
> I thank you for an answer!
> 
> bye Ilka

Just type the names.  For example:

 > runif
function (n, min = 0, max = 1)
.Internal(runif(n, min, max))
<environment: namespace:stats>

This indicates that all the work is being done by the internal function 
named runif.  You'll need the R source to find that.  For example, start at

https://svn.r-project.org/R/trunk/src/main/names.c

the file that establishes the relation between ".Internal" names and C 
function names.  It has:

{"runif",	do_random2,	9,	11,	3,	{PP_FUNCALL, PREC_FN,	0}},

which is not very good news for you:  do_random2 handles a lot of 
different distributions.  So you'll need to find where that function is 
(it's in src/main/random.c), trace through it to see how it handles code 
9 (it calls runif in src/nmath/runif.c), and so on.

I hope that helps a bit, but what you're asking is not easy.

Duncan Murdoch