Browse Source

Fixed build

Christophe Riccio 14 years ago
parent
commit
ca88ff50dd
2 changed files with 17 additions and 2 deletions
  1. 2 2
      glm/gtc/random.inl
  2. 15 0
      test/gtc/gtc_random.cpp

+ 2 - 2
glm/gtc/random.inl

@@ -92,8 +92,8 @@ GLM_FUNC_QUALIFIER genType gaussRand
 	
 	
     do
     do
     {
     {
-        x1 = compRand1(genType(-1), genType(1));
-        x2 = compRand1(genType(-1), genType(1));
+        x1 = linearRand(genType(-1), genType(1));
+        x2 = linearRand(genType(-1), genType(1));
 		
 		
         w = x1 * x1 + x2 * x2;
         w = x1 * x1 + x2 * x2;
     } while(w > genType(1));
     } while(w > genType(1));

+ 15 - 0
test/gtc/gtc_random.cpp

@@ -69,6 +69,7 @@ int test_sphericalRand()
 		double ResultDoubleA = 0.0f;
 		double ResultDoubleA = 0.0f;
 		double ResultDoubleB = 0.0f;
 		double ResultDoubleB = 0.0f;
 		double ResultDoubleC = 0.0f;
 		double ResultDoubleC = 0.0f;
+
 		for(std::size_t i = 0; i < Max; ++i)
 		for(std::size_t i = 0; i < Max; ++i)
 		{
 		{
 			ResultFloatA += glm::length(glm::sphericalRand(1.0f));
 			ResultFloatA += glm::length(glm::sphericalRand(1.0f));
@@ -98,6 +99,7 @@ int test_diskRand()
 	{
 	{
 		float ResultFloat = 0.0f;
 		float ResultFloat = 0.0f;
 		double ResultDouble = 0.0f;
 		double ResultDouble = 0.0f;
+
 		for(std::size_t i = 0; i < 100000; ++i)
 		for(std::size_t i = 0; i < 100000; ++i)
 		{
 		{
 			ResultFloat += glm::length(glm::diskRand(2.0f));
 			ResultFloat += glm::length(glm::diskRand(2.0f));
@@ -116,7 +118,20 @@ int test_ballRand()
 {
 {
 	int Error = 0;
 	int Error = 0;
 
 
+	{
+		float ResultFloat = 0.0f;
+		double ResultDouble = 0.0f;
 
 
+		for(std::size_t i = 0; i < 100000; ++i)
+		{
+			ResultFloat += glm::length(glm::ballRand(2.0f));
+			ResultDouble += glm::length(glm::ballRand(2.0));
+		}
+
+		Error += ResultFloat < 200000.f ? 0 : 1;
+		Error += ResultDouble < 200000.0 ? 0 : 1;
+		assert(!Error);
+	}
 
 
 	return Error;
 	return Error;
 }
 }