Skip to content

Commit

Permalink
Fixed compiler warning.
Browse files Browse the repository at this point in the history
  • Loading branch information
hmatuschek committed Dec 11, 2020
1 parent cc0ebc2 commit c07ea66
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/effect.cc
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,12 @@ NoiseEffect::bytesAvailable() const {

void
NoiseEffect::gaussRNG(float &a, float &b) {
float x = 2*float(rand())/RAND_MAX - 1;
float y = 2*float(rand())/RAND_MAX - 1;
float x = 2*float(rand())/float(RAND_MAX) - 1;
float y = 2*float(rand())/float(RAND_MAX) - 1;
float s = x*x + y*y;
while (s >= 1) {
x = 2*float(rand())/RAND_MAX - 1;
y = 2*float(rand())/RAND_MAX - 1;
x = 2*float(rand())/float(RAND_MAX) - 1;
y = 2*float(rand())/float(RAND_MAX) - 1;
s = x*x + y*y;
}
a = x*std::sqrt(-2*std::log(s)/s);
Expand Down

0 comments on commit c07ea66

Please sign in to comment.