How to compute (negative binomial) distribution PDF and CDF in C++?

wil*_*lem 6 c++ random

STD has many distributions, that apparently are used to generate pseudo random variables, see e.g. below code that generates and outputs some negative binomial distributed numbers.

Now this might mean that internally, there is code that computes the CDF and or PDF of the negative binomial distribution, i.e. the probability that the random variable takes on a certain value, e.g. 6. Is there a way to output that probability? If yes, how? I know I could run my own code for that, but I'd rather not do that if it there is some way to get the probabilities from std.

If possible, same question for other distributions, e.g. CDF of gamma distribution.

int main()
{
   std::negative_binomial_distribution<int> negBin{ 5,0.5 };//Negative binomial distribution
   std::mt19937 RNG(260783);//Random generator
   for (size_t i = 0; i < 4; i++)
   {
        std::cout << negBin(RNG) << std::endl;
   }
   return 0;
}
Run Code Online (Sandbox Code Playgroud)

Cal*_*eth 1

该标准没有指定实现应该如何实现分布,只是从中采样应该从生成器中获取摊销恒定数量的样本。

没有成员提供 CDF 或 PDF