Look in the sources of runif for the C code? On Fri, Mar 5, 2010 at 3:54 PM, TheSavageSam <jujok...@jyu.fi> wrote: > > I am wishing to write my own random distribution simulation function using C > programmin language(for speed) via R. I am familiar with R programming but > somewhat new to C programming. I was trying to understand "Writing R > extensions" -guide and its part 6.16, but I found it hard to > understand(http://cran.r-project.org/doc/manuals/R-exts.html#Standalone-Mathlib). > I also tried to get familiar with the example codes, but it didn't make me > any wiser. > > The biggest problem seems to be how to get(what code to write in C) random > uniform numbers using Rmath. That seems to be too complicated to me at the > moment. So if someone of you could give a small example and it would > definitely help me a lot. All I wish to do first is to finally write(and > understand) my own function similar to what you run in R Command line via > command "runif". > > And all this I am hoping to do without recompiling my whole R. Instead of > that I think that it is possible to use dyn.load("code.so") in R. (Yes, I > use linux) > -- > View this message in context: > http://n4.nabble.com/Writing-own-simulation-function-in-C-tp1580190p1580190.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >
-- Stephen Sefick Let's not spend our time and resources thinking about things that are so little or so large that all they really do for us is puff us up and make us feel like gods. We are mammals, and have not exhausted the annoying little problems of being mammals. -K. Mullis ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.