montecarloprng

Reliable and fast pseudo random number generator (PRNG) for Monte Carlo simulation in .net


I use pseudo random number generators (PRNG) to Monte Carlo simulate a queueing type of system. I use System.Random, because it is fast, but found out that it has some weird correlation between subsequent draws, which interferes with the results (it is not random enough).

Now I am using Mersenne Twister (http://takel.jp/mt/MersenneTwister.cs), which (up until now) has proven to be random enough for my purposes. It is 50% slower, but that is a price I am willing to pay to get reliable results.

What PRNG for .net is most suitable for Monte Carlo simulation? I am looking for a reliable PRNG that is not too slow.


Solution

  • The Mersenne Twister has been optimized for use with Monte Carlo simulations in a number of fields, so i would stick to that one.

    If performance is an issue and going parralell is not an option i would go for an XORshift generator. A very good (fast) random number generator from Geroge Marsaglia.

    Here's the paper:

    That is probably your best bet if you need a good and fast PRNG for some monte carlo or other statistical simulations, not for cryptography though.

    At this SO post you can find a very simple port in JAVA, but should be not that hard to rewrite or find a C# implementation on the net.