#include "cpp3rdlib/boost/include/boost/math/distributions.hpp" #include "cpp3rdlib/boost/include/boost/random/mersenne_twister.hpp" float rand_beta_dist(float alpha, float beta) { static thread_local boost::random::mt19937 seed(std::time(0)); std::uniform_real_distribution<float> uniform_dist(0.0, 1.0); auto rand_uniform = uniform_dist(seed); boost::math::beta_distribution<> beta_dist(alpha, beta); auto rand_beta = boost::math::quantile(beta_dist, rand_uniform); return rand_beta; }