Jump to content
  • Advertisement
Sign in to follow this  
Matthew Doucette

random number generation w/ normal distribution

This topic is 3866 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites
Advertisement
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.

Share this post


Link to post
Share on other sites
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!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!