Part of the mathematical model developed along these years works with the Monte Carlo method. Did you ever eared talking about stochastic?! Don’t worry… me neither until 3 years ago. Basically, I generate (pseudo-) random numbers, which will dictate what decision to take. The code is written in the C language, and I was compelled to initiate the random numbers, using a seed, well… in this case, the seed is the time.

Yesterday I have made some changes in the code. To verify the results I need to run at least 25*4 simulations, each simulation represents a single point in a graph and takes about 15 minutes to run. So I’ve putted in comment about 90% of the code, in this way I should save some time. Indeed, each simulation is completed in the maximum of 2 minutes, but… there is a big, HUGE problem. The random numbers have not a wide and dispersed range and I can not get the results that I should have. I only get a stagnant line (equal to zero). On the contrary, if I run all the code, which implies higher time consumption, I get the results expected.

Someday I could do some optimization in a way to reduce the computational time (well, I doubt it, but just imagine the scenario), but the question is… would I get the same results?! I don’t think so.

Is there any seed that I could use instead the time?!

## No comments:

Post a Comment