int criticalValueLow = 0;
int criticalValueHigh = numberOfTrials;
double pTotal = 0;
while (true) {
double pLow = distribution.probability(criticalValueLow);
double pHigh = distribution.probability(criticalValueHigh);
if (pLow == pHigh) {
pTotal += 2 * pLow;
criticalValueLow++;