normrand() doesn't make normally distributed numbers
Posted: Mon Oct 05, 2009 7:14 am
Now I presume I'm doing something wrong here, but normrand() doesn't pull out numbers from a normal distribution. It looks more like a Lorentizian Distribution (see image)
Also, the arguements (that I assumed were mean, stddev or mean, coefvar) doesn't seem to do a thing. I always get the same distribution.
I'll spare you the whole mod file, but this is the "offending" piece
What is going on here?

Clearly not normal. On a logged Y axis, normal distributions appear parabolic. But a Lorentzian curve seems to fit it okay.
Also, the arguements (that I assumed were mean, stddev or mean, coefvar) doesn't seem to do a thing. I always get the same distribution.
I'll spare you the whole mod file, but this is the "offending" piece
Code: Select all
VERBATIM
static float Quanta_With_Var(int num, float amp, float coefvar) {
int i;
float totalG=0;
for(i=0; i<=num; ++i) {
totalG+=normrand(amp, amp*coefvar);
printf("%f\n", normrand(10, 100));
}
return (float) totalG;
}
ENDVERBATIM

Clearly not normal. On a logged Y axis, normal distributions appear parabolic. But a Lorentzian curve seems to fit it okay.