summaryrefslogtreecommitdiff
path: root/AvalancheTest.cpp
diff options
context:
space:
mode:
authortanjent@gmail.com <tanjent@gmail.com@77a7d1d3-4c08-bdc2-d393-d5859734b01a>2012-03-01 03:38:55 +0000
committertanjent@gmail.com <tanjent@gmail.com@77a7d1d3-4c08-bdc2-d393-d5859734b01a>2012-03-01 03:38:55 +0000
commitf3b789787b93945c974e2cc517b7dc352b28354e (patch)
tree964ce5b7a74e21ce9056d974270ae7ba8d3389cd /AvalancheTest.cpp
parentb35e562e2d80bc47a51b53ec92a305eb9a3383b4 (diff)
downloadsrc-f3b789787b93945c974e2cc517b7dc352b28354e.tar.gz
Merge branch chandlerc_dev
git-svn-id: http://smhasher.googlecode.com/svn/trunk@144 77a7d1d3-4c08-bdc2-d393-d5859734b01a
Diffstat (limited to 'AvalancheTest.cpp')
-rw-r--r--AvalancheTest.cpp112
1 files changed, 56 insertions, 56 deletions
diff --git a/AvalancheTest.cpp b/AvalancheTest.cpp
index 38aa452..f5ea0df 100644
--- a/AvalancheTest.cpp
+++ b/AvalancheTest.cpp
@@ -1,56 +1,56 @@
-#include "AvalancheTest.h"
-
-//-----------------------------------------------------------------------------
-
-void PrintAvalancheDiagram ( int x, int y, int reps, double scale, int * bins )
-{
- const char * symbols = ".123456789X";
-
- for(int i = 0; i < y; i++)
- {
- printf("[");
- for(int j = 0; j < x; j++)
- {
- int k = (y - i) -1;
-
- int bin = bins[k + (j*y)];
-
- double b = double(bin) / double(reps);
- b = fabs(b*2 - 1);
-
- b *= scale;
-
- int s = (int)floor(b*10);
-
- if(s > 10) s = 10;
- if(s < 0) s = 0;
-
- printf("%c",symbols[s]);
- }
-
- printf("]\n");
- }
-}
-
-//----------------------------------------------------------------------------
-
-double maxBias ( std::vector<int> & counts, int reps )
-{
- double worst = 0;
-
- for(int i = 0; i < (int)counts.size(); i++)
- {
- double c = double(counts[i]) / double(reps);
-
- double d = fabs(c * 2 - 1);
-
- if(d > worst)
- {
- worst = d;
- }
- }
-
- return worst;
-}
-
-//-----------------------------------------------------------------------------
+#include "AvalancheTest.h"
+
+//-----------------------------------------------------------------------------
+
+void PrintAvalancheDiagram ( int x, int y, int reps, double scale, int * bins )
+{
+ const char * symbols = ".123456789X";
+
+ for(int i = 0; i < y; i++)
+ {
+ printf("[");
+ for(int j = 0; j < x; j++)
+ {
+ int k = (y - i) -1;
+
+ int bin = bins[k + (j*y)];
+
+ double b = double(bin) / double(reps);
+ b = fabs(b*2 - 1);
+
+ b *= scale;
+
+ int s = (int)floor(b*10);
+
+ if(s > 10) s = 10;
+ if(s < 0) s = 0;
+
+ printf("%c",symbols[s]);
+ }
+
+ printf("]\n");
+ }
+}
+
+//----------------------------------------------------------------------------
+
+double maxBias ( std::vector<int> & counts, int reps )
+{
+ double worst = 0;
+
+ for(int i = 0; i < (int)counts.size(); i++)
+ {
+ double c = double(counts[i]) / double(reps);
+
+ double d = fabs(c * 2 - 1);
+
+ if(d > worst)
+ {
+ worst = d;
+ }
+ }
+
+ return worst;
+}
+
+//-----------------------------------------------------------------------------