I needed to develop a C++ program, so I did the best I could (having no previous C++ experience). It required me to generate random numbers from a Normal distribution. I now need to modify it, preferably to work in a similar manner, for the Beta distribution. My original code goes like this:
However, the Beta distribution does not seem to be part of the "random" package in boost. It can be found as follows: #include <boost/math/distributions/beta.hpp>
So when I try to marry up the two by doing:
...it does not work. I'm pretty sure I;m doing something conceptually wrong, but I don't have the core understanding of C++ coding to get it. Any help on how to get the Beta distribution working in the method given? If it's just not possible, what would be my best and simplest option that allows me to save my seed and gives easy access to the Beta distribution?
I just realised that there is a huge problem. Basically I need to generate (1,000,000)^2 numbers from this distribution. My program worked for 10-15 hours for other distributions such as exponential, normal, etc. A test run of my simulation showed that the Beta distribution will have to run for 25 days. The complexity of the Beta is a bit higher but it shouldn't account for that much. I can only think of two things that may be causing this:
1. The Beta distribution is much more complicated to simulate than the more well-known distributions.
2. The method from StackOverflow is inferior to the one I've been using.