Does anyone know a C library that has some standard probability functions like Rs sample function? I found this:
http://www.gnu.org/software/gsl/
I was wondering if anyone has had any experience with it (how efficient it is) and if there are any other ones. Thanks.
You can always embed R itself in your C application. That is doable, and documented, but a tad tedious as the API is pretty bare.
If you are open to C++, it gets much easier thanks to RInside. If you can do this in R:
you can do the same in C++ pretty easily thanks to RInside:
and given that it runs the same code with the same RNG seed it also returns the same result:
If you just drop the code I showed above into the directory
examples/standardof an existing RInside installation and saymake, the executable will be made and given the same basename as your source file (hererinside_sample12fromrinside_sample12.cpp).