diff options
| author | Ritabrata Das <[email protected]> | 2026-09-09 21:07:21 +0530 |
|---|---|---|
| committer | Ritabrata Das <[email protected]> | 2026-09-09 21:07:21 +0530 |
| commit | ffd968a26826108ca9fb23d46ed5789260852eb7 (patch) | |
| tree | 3861d08dae1c28f547952dbcc16e04ae7b5286b5 /test | |
intial commit
Diffstat (limited to 'test')
| -rw-r--r-- | test/probablity.cpp | 18 |
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; +} |
