Is there a JAVA version of the std::piecewise_linear_distribution? I have a C++ code like the following that I need to convert to JAVA.
std::mt19937 g;
const std::vector<double> i{-3333333, -2222222, -11111, 0, 11111, 2222222, 4444444};
const std::vector<double> w{0.0005, 0.0057, 7.9, 9999, 7.9, 0.0057, 0.0005};
std::piecewise_linear_distribution<> IWrnd(i.begin(), i.end(), w.begin());
g.seed(seed);
randomNumber = IWrnd(g);
I do not know the algorithm of std::piecewise_linear_distribution and I was not able to understand from the STL templates so I am not sure how this should look like in JAVA.
Is there an implementation of this in some JAVA package like java.util.Random? Or can someone post the algorithm for this?
Aucun commentaire:
Enregistrer un commentaire