random number generation w/ normal distribution
Looking for a random number generator that has NORMAL DISTRIBUTION. One way to approximate this is to take the average of three random numbers. (Two random numbers is not enough, as the distribution is not curved.) Is there a faster and/or more accurate way?
What programming language are you using? Some programming languages or compilers have built in support for normal distributions. Others, like C++ have accessible add-on libraries like boost::random that supply normal distribution RNGs.
I'm using MSVC++... but I want to know the algorithms to program it myself. No add-ons if possible.
Thanks for the insight!
My random number generator is fast enough that generating 3 random numbers and taking their average (my first solution above) is FASTER than the Box-Muller transform which requires 2 random numbers, a cosine or sine, and a natural logarithm.
I realize the Box-Muller transform is probably a closer approximation to normal distribution, so to each their own. But thanks for bringing this to my attention!
My random number generator is fast enough that generating 3 random numbers and taking their average (my first solution above) is FASTER than the Box-Muller transform which requires 2 random numbers, a cosine or sine, and a natural logarithm.
I realize the Box-Muller transform is probably a closer approximation to normal distribution, so to each their own. But thanks for bringing this to my attention!
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement