By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,952 Members | 1,942 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,952 IT Pros & Developers. It's quick & easy.

How to generate random number in gaussian distribution?

100+
P: 151
How to generate random number in normal distribution without using any external library. I found few methods implementing
it. But all use GSL or boost. I don't want to use any third party library. Thanks in advance.
Nov 27 '10 #1
Share this Question
Share on Google+
2 Replies


Expert 100+
P: 2,396
rand (with srand) from <stdlib.h> approximates a uniform distribution. Have you investigated any of the algorithms that derive a standard distribution from uniformly distributed values (see Normal distribution).

Another place to look is the Gnu Scientific Library (GSL).
Nov 29 '10 #2

emaghero
P: 85
The text "Numerical Recipes in C" contains a chapter on random number generation. The chapter describes the techniques used to create random numbers from distributions. It also includes C source code.
Nov 29 '10 #3

Post your reply

Sign in to post your reply or Sign up for a free account.