Skip to content

Commit

Permalink
Fix Box-Muller factor per issue ivanseidel#6
Browse files Browse the repository at this point in the history
  • Loading branch information
drf5n committed Mar 26, 2023
1 parent b7d1beb commit fd2c218
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Gaussian.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ class Gaussian
double R1, R2;
R1 = ::random(MAX_VARIANCE)/(double)MAX_VARIANCE;
R2 = ::random(MAX_VARIANCE)/(double)MAX_VARIANCE;
return mean + variance * cos( 2 * M_PI * R1) * sqrt(-log(R2));
return mean + variance * cos( 2 * M_PI * R1) * sqrt(-2*log(R2));
}

virtual double plot(double x){
Expand Down

0 comments on commit fd2c218

Please sign in to comment.