Good Random Number Generator
Hi,
Im using the Monte Carlo method to get an estimate of Pi.
I generate numbers between 0.0 and 1.0, using the following function (similar to the one in the FAQ)
Code:
double generate_rand(double min, double max)
{
static int Init = 0;
double rc;
if (Init == 0)
{
srand(time(NULL));
Init = 1;
}
rc = (rand() / (RAND_MAX + 1.0) * (max - min) + min);
return rc;
}
The estimation of pi depends on the quality of the random number generator, I was wondering if there is any way to make my function generate 'better' random numbers?