Posted by
Jens Thiel-2 on
May 14, 2003; 4:23pm
URL: http://quantlib.414.s1.nabble.com/Problem-with-random-seed-tp10243p10244.html
Hi,
Some quick ideas here:
- 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)
The last one may be the most portable and efficient...
Jens.
-----Original Message-----
From:
[hidden email]
[mailto:
[hidden email]] On Behalf Of Niels Elken
Sønderby
Sent: Wednesday, May 14, 2003 10:49 PM
To: QuantLib-dev
Subject: [Quantlib-dev] Problem with random seed
Hi again
There is a small problem with the random number generator. When a Rng is
constructed, it initialises the generator with a seed based on the current
time. However, (at least in VC++) the resolution of the timer is only one
second. This means that the same sequence of random numbers will be
generated.
Normally, this is not a problem, as e.g. the PathGenerator next() method
will not be reseeded with the same seed. But the problems shows, when
PathGenerator is called repeatedly from an external program.
My particular program is in the QuantLibMma extension, where the following
code will give 5 identical paths.
model = BlackScholesModel[100, 0.10, 0.01, 0.15];
Table[MonteCarloPath[model, 1, 20], {5}]
Does anyone know how to solve this problem? Is there a seed with a higher
resolution the QL_TIME?
Cheers... Niels
-------------------------------------------------------
Enterprise Linux Forum Conference & Expo, June 4-6, 2003, Santa Clara The
only event dedicated to issues related to Linux enterprise solutions
www.enterpriselinuxforum.com
_______________________________________________
Quantlib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev