C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

how to generate random data for a normal distribution

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++)
View previous topic :: View next topic  
Author Message
Yudan YI (OSU)
Guest





PostPosted: Thu Feb 24, 2005 4:52 am    Post subject: how to generate random data for a normal distribution Reply with quote



I want to generate random data from a normal distribution, while I checked
the functions, and I found rand(), which returns a pseudorandom integer
between zero and RAND_MAX. I am not sure how to use this function to
generate my random data from a normal distribution.

Thanks
Yudan


Back to top
James Rafter
Guest





PostPosted: Thu Feb 24, 2005 6:55 am    Post subject: Re: how to generate random data for a normal distribution Reply with quote



This is not really a C++ question. But...

Google 'Numerical Recipes'. There's a NR in C, C++, Fortran, etc. The
C one is available online.
but the C++ one is not.

Chapter 7 of the C book will show you what you need to do this from
scratch.
Perhaps others can recommend libraries if you don't want to do that.

Back to top
Dietmar Kuehl
Guest





PostPosted: Thu Feb 24, 2005 9:24 am    Post subject: Re: how to generate random data for a normal distribution Reply with quote



Yudan YI (OSU) wrote:
Quote:
I want to generate random data from a normal distribution, while I
checked
the functions, and I found rand(), which returns a pseudorandom
integer
between zero and RAND_MAX. I am not sure how to use this function to
generate my random data from a normal distribution.

Have a look at the random number generator library at Boost
(<http://www.boost.org/>): this library supports several
distributions and the random number generators also have a
few other advantages of the typical standard library
implementations of 'rand()'. A library with essentially this
interface is also part of the standard library technical
report which includes candidates for future standard library
extensions.
--
<mailto:dietmar_kuehl (AT) yahoo (DOT) com> <http://www.dietmar-kuehl.de/>
<http://www.contendix.com> - Software Development & Consulting


Back to top
hautrub
Guest





PostPosted: Thu Feb 24, 2005 6:57 pm    Post subject: Re: how to generate random data for a normal distribution Reply with quote

Hi,

Is there any other links to random number generator?

[email]kongyew (AT) w-manager (DOT) com[/email]

Back to top
rossum
Guest





PostPosted: Thu Feb 24, 2005 10:59 pm    Post subject: Re: how to generate random data for a normal distribution Reply with quote

On 23 Feb 2005 22:55:40 -0800, "James Rafter" <jjr2004a (AT) yahoo (DOT) com>
wrote:

Quote:
This is not really a C++ question. But...

Google 'Numerical Recipes'. There's a NR in C, C++, Fortran, etc. The
C one is available online.
but the C++ one is not.

Chapter 7 of the C book will show you what you need to do this from
scratch.
Perhaps others can recommend libraries if you don't want to do that.

The C version is here:
http://www.library.cornell.edu/nr/cbookcpdf.html

Beware of the code style, it is a good example of the saying "A real
programmer can write FORTRAN in any language."

rossum

--

The ultimate truth is that there is no Ultimate Truth

Back to top
Dietmar Kuehl
Guest





PostPosted: Fri Feb 25, 2005 10:07 am    Post subject: Re: how to generate random data for a normal distribution Reply with quote

hautrub wrote:
Quote:
Is there any other links to random number generator?

Probably but none that I'm immediately aware of without search
the Internet. Well, you can look at the technical report on
library extension at the standard C++ site but this is
essentially the Boost library in a different namespace and,
AFAIK, without a ready implementation.

However, out of curiosity: what desires in random number
generation leaves the Boost random number generator library
unsatisfied?
--
<mailto:dietmar_kuehl (AT) yahoo (DOT) com> <http://www.dietmar-kuehl.de/>
<http://www.contendix.com> - Software Development & Consulting


Back to top
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.