Random Gaussian numbers
-
Dear all, I was wondering if there is a way to generate random gaussian numbers with Visual C++. Borland Builder has the option
randg
to do just this. Many many thanks Chun Te -
Dear all, I was wondering if there is a way to generate random gaussian numbers with Visual C++. Borland Builder has the option
randg
to do just this. Many many thanks Chun TeChun Te, Ewe wrote: gaussin What is that? look up
rand()
in MSDN Library Rickard Andersson@Suza Computing C# and C++ programmer from SWEDEN! UIN: 50302279 E-Mail: nikado@pc.nu Speciality: I love C#, ASP.NET and C++! -
Chun Te, Ewe wrote: gaussin What is that? look up
rand()
in MSDN Library Rickard Andersson@Suza Computing C# and C++ programmer from SWEDEN! UIN: 50302279 E-Mail: nikado@pc.nu Speciality: I love C#, ASP.NET and C++!Sorry for the typo. The rand() just generates random numbers but not gaussian/normal distribution numbers. Chun Te
-
Sorry for the typo. The rand() just generates random numbers but not gaussian/normal distribution numbers. Chun Te
Chun Te, Ewe wrote: gaussian Sorry, but I don't know what a gaussian number is! :( Try go to www.msdn.microsoft.com and type in "gaussian" in the search field of "MSDN Library" and then see if you find something. Cheers! :) Rickard Andersson@Suza Computing C# and C++ programmer from SWEDEN! UIN: 50302279 E-Mail: nikado@pc.nu Speciality: I love C#, ASP.NET and C++!
-
Dear all, I was wondering if there is a way to generate random gaussian numbers with Visual C++. Borland Builder has the option
randg
to do just this. Many many thanks Chun TeSee This article[^] I see dumb people
-
Dear all, I was wondering if there is a way to generate random gaussian numbers with Visual C++. Borland Builder has the option
randg
to do just this. Many many thanks Chun Te -
Chun Te, Ewe wrote: gaussian Sorry, but I don't know what a gaussian number is! :( Try go to www.msdn.microsoft.com and type in "gaussian" in the search field of "MSDN Library" and then see if you find something. Cheers! :) Rickard Andersson@Suza Computing C# and C++ programmer from SWEDEN! UIN: 50302279 E-Mail: nikado@pc.nu Speciality: I love C#, ASP.NET and C++!
Rickard Andersson wrote: Sorry, but I don't know what a gaussian number is! It's not a gaussian number, it's a gaussian distribution. Let's pick a simple example: if you plot people's weight x #number of people with a specific weight, you'll get a gaussian distribution: most samples will concentrate on the middle of the graphic and less people on the borders. Gaussian distribution are also know as Normal distributions. It's know as the "bell curve" too. A picture worth more than a thousand words. See This article[^] I see dumb people
-
See This article[^] I see dumb people
Thanks...
-
Hehehe, I got you by a minute! I see dumb people
-
Dear all, I was wondering if there is a way to generate random gaussian numbers with Visual C++. Borland Builder has the option
randg
to do just this. Many many thanks Chun TeI've found a mathematical formula to do this now. It assume zero mean and it is written in MatLab.
sigma = 2; %The std deviation x1 = rand(1000,1); %Linear rand number between 0.0 to 1.0 x2 = rand(1000,1); z = sqrt(-2*sigma*log(x1)) * cos(2*pi*x2);
the log here is ln, that is log to the base e. Now all we need is just to put it in C. Thanks to all who replied my post. -
I've found a mathematical formula to do this now. It assume zero mean and it is written in MatLab.
sigma = 2; %The std deviation x1 = rand(1000,1); %Linear rand number between 0.0 to 1.0 x2 = rand(1000,1); z = sqrt(-2*sigma*log(x1)) * cos(2*pi*x2);
the log here is ln, that is log to the base e. Now all we need is just to put it in C. Thanks to all who replied my post.You can use the code you listed to generate normal variates, but I believe you will get garbage out in the tails of the distribution. The random number generator that is packaged with C is not very good. I suggest you find a better one...there are plenty of them out on the web. Here is an example http://www.cs.wm.edu/~va/software/park/park.html Gary Kirkham A working Program is one that has only unobserved bugs
-
You can use the code you listed to generate normal variates, but I believe you will get garbage out in the tails of the distribution. The random number generator that is packaged with C is not very good. I suggest you find a better one...there are plenty of them out on the web. Here is an example http://www.cs.wm.edu/~va/software/park/park.html Gary Kirkham A working Program is one that has only unobserved bugs
Thanks for the suggestion. I look into it.