I want to get a boost::variate_generator which gives me numbers distributed to the lognormal distribution according to http://en.wikipedia.org/wiki/Log-normal_distribution.
There is a distribution in boost::math that implements the formula from the wikipedia entry, but it doesn’t work with the variate_generator.
And the one from boost::random, that works with the variate_generator, is somewhat different from the above mentioned.
http://www.boost.org/doc/libs/1_46_1/doc/html/boost/lognormal_distribution.html. Mu needs to be >0 and mu and sigma are calculated instead of just used as given.
Does someone have any idea how I can get it to work with the former formula?
EDIT
@ Howard Hinnant:
there is this init() function which gets called in the constructor. So the formula is the same, but sigma and mean get calculated this way (why I don’t know):
_nmean = log(_mean*_mean/sqrt(_sigma*_sigma + _mean*_mean));
_nsigma = sqrt(log(_sigma*_sigma/_mean/_mean+result_type(1)));
I may be mistaken, but from inspecting the boost code, it looks to me like the boost lognormal_distribution is consistent with the wikipedia description. The documentation would be consistent if the boost documentation dropped the N subscript from mu and sigma.