"mescaline" <ap*****@columbia.edu> wrote in message
news:e5**************************@posting.google.c om...
hi,
i'm new to C++
could anyone refer me to a good site / good examples of random
numbers?
Check out for example the boost library.
in particular including:
1) the commnds to obtain normally and exponenetially distributed r
numbers
There are no such commands available. The "only" thing available is a random
generator which delivers (more or less) uniform numbers but this is enough.
2) how the above types of random numbers are generated from uniform
rvs
To obtain a normal distribution check out the Box Mueller formula and for
exponential distributed numbers you can easily use the transformation
method.
i need to generate random numbers, normal and exponenetial, and then
use them in a Monte Carlo simulation to obtain their mean and
variance.
So any Monte Carlo code direction would also be appreciated.
I crudely know how to do this (because i've done it matlab) but I am
aiming to be professional in C++ and would like to do the above
generation in a sophisiticated way.
You could go ahead implementing a base class like a CRandomKernel which
includes a good random generator for a uniform distribution. This base class
might also implement for example a rejection method or other sampling
algorithms and for a specialized distribution you might derive and supply
your specialized PDF or you could solve it providing function pointers.
HTH
Chris