Skip to content

R_Code

3 messages · Ilka Schmidt, Duncan Murdoch, Hans-Peter

#
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
--
#
On 12/12/2006 11:39 AM, Ilka Schmidt wrote:
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
#
2006/12/13, Duncan Murdoch <murdoch at stats.uwo.ca>:
[snipped]

Good description. Thank you!!