I'm trying to optimize a Bayesian inference algorithm written in C. I'm looking for fast and accurate open-source libraries for working with probability distributions (both calculating density & drawing deviates - like the rnorm,dnorm,pnorm functions in R). So far I've found a tutorial which suggested the gsl library but I was wondering if anyone knew of anything better?

The last time I did anything with Bayesian algorithms was back in the dark ages when we had to write everything from scratch... :-) Sorry that I don't know what C libraries are out there for that. I think that the Boost C++ libraries has support for this, but I'm not sure as I haven't had to do anything like that "since the dark ages".