It's a web service, so the class would be initializing from scratch on every call and be reseeded anyway, unless you make the Mersenne Twister randomizer class instance static
so it doesn't need to be reseeded. If you do that, however, you should reinitialize (destroy/recreate) the instance every so often, as the Mersenne Twister values are guessable after 600-something pulls.
For performance, it would be best to make a static instance and reinitialize every 500 pulls as per the following pseudocode:
class RandomNumberGenerator
{
static MersenneTwisterClass RNG = null;
static object RNGLock = new object();
static int counter = 0;
public RandomNumberGenerator()
{
Init();
}
void Init()
{
// Multithreading lock
lock (RNGLock)
{
// Seed it or don't, your call
RNG = new MersenneTwisterClass(some_seed_value_or_nah);
counter = 0;
}
}
public decimal GetValue()
{
lock (RNGLock)
{
counter++;
if (counter > 500)
{
Init();
}
return RNG.GetValue();
}
}
public long GetRange(long min, long max)
{
lock (RNGLock)
{
counter++;
if (counter > 500)
{
Init();
}
return RNG.GetRange(min, max);
}
}
}