Re: change standard deviation of normal or Gaussian distribution (faq 13.20)
- From: Verbal Kint <TENSOAPFEN@xxxxxxxxx>
- Date: Fri, 29 Jun 2007 09:20:24 -0000
:) I understand what you mean. Maybe I didnt express myself clear
enough. I wanted to use to following method as mentioned in FAQ:
double gaussrand()
{
static double V1, V2, S;
static int phase = 0;
double X;
if(phase == 0) {
do {
double U1 = (double)rand() / RAND_MAX;
double U2 = (double)rand() / RAND_MAX;
V1 = 2 * U1 - 1;
V2 = 2 * U2 - 1;
S = V1 * V1 + V2 * V2;
} while(S >= 1 || S == 0);
X = V1 * sqrt(-2 * log(S) / S);
} else
X = V2 * sqrt(-2 * log(S) / S);
phase = 1 - phase;
return X;
}
Now I wonder, whether I can multiply the standard deviation of e.g.
0.5 with X or with which variable (v1, v2, etc.) I need to multiply
it?
Thanks a lot.
.
- Follow-Ups:
- Re: change standard deviation of normal or Gaussian distribution (faq 13.20)
- From: mark_bluemel
- Re: change standard deviation of normal or Gaussian distribution (faq 13.20)
- References:
- change standard deviation of normal or Gaussian distribution (faq 13.20)
- From: Verbal Kint
- Re: change standard deviation of normal or Gaussian distribution (faq 13.20)
- From: mark_bluemel
- change standard deviation of normal or Gaussian distribution (faq 13.20)
- Prev by Date: Re: reply the answer
- Next by Date: Re: extern "C" in library header
- Previous by thread: Re: change standard deviation of normal or Gaussian distribution (faq 13.20)
- Next by thread: Re: change standard deviation of normal or Gaussian distribution (faq 13.20)
- Index(es):