mardi 28 septembre 2021

Generate Beta distributed random variables on GCC and MS C++17

The below code gives me a beta distributed random variable in MSVC c++17:

std::mt19937 gen;
std::_Beta_distribution<float> beta(0.5, 0.5);
std::cout << beta(gen) << std::endl;

Unfortunately, the same code will not compile on GCC9.3.0. I need code, preferably a single approach that works across both platforms but I will do for separate approaches, to generate a Beta distributed random variable, without using Boost. How to approach this? Is std::_Beta_distribution hidden somewhere else for GCC? Or do I need to write my own code?




Aucun commentaire:

Enregistrer un commentaire