summaryrefslogtreecommitdiff
path: root/test/probablity.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/probablity.cpp')
-rw-r--r--test/probablity.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/probablity.cpp b/test/probablity.cpp
new file mode 100644
index 0000000..510c714
--- /dev/null
+++ b/test/probablity.cpp
@@ -0,0 +1,18 @@
+#include <cstdlib>
+#include <stdio.h>
+
+#include "../lib/standard.cpp"
+
+#define SAMPLE_SIZE 10000000
+
+int main () {
+ int trueCount = 0;
+ srand(111111);
+ for (int i = 0; i < SAMPLE_SIZE; i++) {
+ bool result = returnTrueProbPerc(30);
+ if (result) {trueCount++;}
+ }
+ float percentage = ((float)trueCount/SAMPLE_SIZE)*100;
+ printf("%f\n", percentage);
+ return 0;
+}