I am not sure this is the right platform for this comment/question, however consider the following code snippet:
#include <random>
#include <iostream>
#include <limits>
int main()
{
int m=std::numeric_limits<int>::max();
std::cout<<m<<"\n";
std::poisson_distribution<int> p(m+1.);//implicit conversion to double
std::mt19937 rng(std::random_device{}());
auto x=p(rng);
std::cout<<x<<std::endl;
return 0;
}
The code compiles and runs. Though clearly it is not sampling correctly the distribution since 50% of the times x should be larger that m+1, something not allowed. On my machine the program spits out only numbers smaller than m but this may be a sort of undefined behavior. In fact if I print std::cout<<p.max()<<"\n"; I obtain m.
Now, I know that mathematically speaking I am essentially sampling from a normal distribution and I could easily go around the issue. However I am wondering if a
a run-time exception should be thrown when the distribution is constructed or if a note should be added in the following page: https://en.cppreference.com/w/cpp/numeric/random/poisson_distribution.
In the case you agree with me who should I contact?