Login  Register

Re: RandomNumberGenerator

Posted by John Kiff on Jun 06, 2004; 7:43pm
URL: http://quantlib.414.s1.nabble.com/RandomNumberGenerator-tp2978p2980.html

Mike, thanks for that, but I was also wondering if there is something more fundamental that I
should be looking at. I checked out my "Numerical Recipes" but so no obvious reference to
dimensions and samples. Maybe I'm using the wrong function, in that I just want to generate a
vector of random standard normals, and nothing much more than that. Anyways, perhaps the
Glasserman and Jackel books go deeper into these nuances, and I have neither. Any opinions as to
which will be the most helpful? John

--- [hidden email] wrote:

> check out rngtraits.hpp and rngtypedefs.hpp
>
> The default pseudo random generator is Mersenne Twister Uniform generator with
> inverse cumulative normal to convert to gaussian. See typedef PseudoRandom.
>
> e.g.
> Size dim1 = 20; //sequence length.
> long seed = 12345;
>
> GaussianRandomSequenceGenerator grsg =
> PseudoRandom::make_sequence_generator(dim1, seed);
> Sample<Array> res = grsg.nextSequence();
> std::cout << res.value <<std::endl;
> std::cout << std::endl;
>
>
>
> Examples of usage in e.g. mcvanillaengine.hpp
>
> or could try,
> typedef GenericPseudoRandom<KnuthUniformRng,
> InverseCumulativeNormal> fred;
> fred::rsg_type gen = fred::make_sequence_generator(dim1, seed);
> std::cout << gen.nextSequence().value <<std::endl;
>
> Also, check out random numbers namespace. Example below uses Box-Mueller
> method of transforming uniforms into gaussians.
>
> BoxMullerGaussianRng<MersenneTwisterUniformRng> bm_grsg(seed);
> for (Size sim=0; sim<10; sim++)
> std::cout << bm_grsg.next().value << std::endl;
>
> BoxMullerGaussianRng<KnuthUniformRng> bm_grsg(seed); etc.
>
> Hope this helps
>
> Quoting John Kiff <[hidden email]>:
>
> > Could someone please give me some pointers to where I can find out more about
> > setting the key
> > parameters of the RandomNumberGenerator function: "dimension", "samples",
> > "RNGType" and "seed"?


       
               
__________________________________
Do you Yahoo!?
Friends.  Fun.  Try the all-new Yahoo! Messenger.
http://messenger.yahoo.com/