From c07ea66abb58c8647336a08082212abe5fb90f7a Mon Sep 17 00:00:00 2001 From: Hannes Matuschek Date: Fri, 11 Dec 2020 14:19:24 +0100 Subject: [PATCH] Fixed compiler warning. --- src/effect.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/effect.cc b/src/effect.cc index a949a6c..c555db8 100644 --- a/src/effect.cc +++ b/src/effect.cc @@ -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);