Posted by
enrico.sirola on
May 15, 2003; 2:31am
URL: http://quantlib.414.s1.nabble.com/Problem-with-random-seed-tp10243p10246.html
>>>>> "Gigi" == Luigi Ballabio <
[hidden email]> writes:
>> - use high-resolution performance counters
>> (QueryPerformanceCounter) - use GUIDs (eg. CoCreateGuid) to get
>> some 128 unique bits - use a master RNG to deliver seeds (use a
>> different alg. here) - get a seed only once, and reseed with
>> (++seed)
Gigi> Another quick one:
Gigi> - Use a global RNG, instead of creating one each time you
Gigi> call MonteCarloPath. Write another function to reinitialize
Gigi> it with a given seed if one wants to do so.
Gigi> This would also make your simulations more akin to what's
Gigi> usually done---i.e., create a RNG, and make paths by using
Gigi> successive draws from that one RNG. I don't think there's
Gigi> many people around reinitializing the generator for each
Gigi> path.
The problem of using different independent RNG is typical in parallel
montecarlo applications, and using two different RNG algorithms (one
for generating seeds and one for generating paths) is a known
solution. One known approach is the "Lagged Fibonacci" method (try a
search with google and you'll find some implementations), anyway you
don't get generators with a huge period (I think something like 10E4 -
10E5) for the paths.
On the other side, using only one generator for generating all the
paths could not scale in the number of paths, anyway you could use a
very high period RNG (the mersenne-twister, which have a huge
period would probably fit financial applications needs).
The Mersenne-Twister inventors released a mersenne-twister variant
suitable for parallel montecarlo applications, anyway its code is GPL
so, unfortunately, impossible to include in QL. I can't remember the
authors' site URL (again, a google search should lead you there).
I hope this helps,
Enrico
--
Enrico Sirola <
[hidden email]>
"Random generators should noy be chosen at random" - D. Knuth