I want to create bunch of random numbers but it should be exponentially distributed. I should use Steve Park & Dave Geyer's Random Number Generation basically I need to add a function to create this. So I did this but it seems it stuck in while. How can I fix this? Thanks in advance!
double RandomRV(void) //Exponential Distribution
{
double i;
double numb;
i = Random();
numb = i / MODULUS;
while (numb < 1.e-6)
{
i = Random();
numb = i / MODULUS;
}
return((double)-500*log(numb));
}
Aucun commentaire:
Enregistrer un commentaire