Ver código fonte

removed unnecessary code duplication which also fixes a nested lock problem

git-svn-id: https://svn.inf.ethz.ch/svn/lecturers/a2/trunk@7295 8c9fc860-2736-0410-a75d-ab315db34111
skoster 8 anos atrás
pai
commit
3bf9081826
1 arquivos alterados com 2 adições e 12 exclusões
  1. 2 12
      source/Random.Mod

+ 2 - 12
source/Random.Mod

@@ -149,18 +149,8 @@ TYPE
 		END Exp;
 		
 		PROCEDURE Gaussian*(): REAL; (*generates a normal distribution with mean 0, variance 1 using the Box-Muller Transform*)
-		VAR
-			x1,x2,w,y1: REAL;
-		BEGIN {EXCLUSIVE}
-			REPEAT
-				x1:=2.0*Uniform()-1;
-				x2:=2.0*Uniform()-1;
-				w:=x1*x1+x2*x2;
-			UNTIL w<1;
-			w:=Math.sqrt( (-2.0* Math.ln(w) ) /w);
-			y1:=x1*w;
-			(*y2:=x2*w*)
-			RETURN y1;
+		BEGIN{EXCLUSIVE}
+			RETURN r.Gaussian();
 		END Gaussian;