Problem with random seed

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Problem with random seed

Niels Elken Sønderby-2
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