Oops sorry, those are hands where Hero has AK because I plugged in 3/245 for the p parameter. If we wanna talk about actual hands dealt, we can't simply use 1/6768 for p because the AK's don't need to happen in a span of 28 hands, it's just the AA's that need to happen in a span of 28 AK's. We can get an approximation by plugging in the average number of AK's. With 100k hands that's 1207, resulting in a probability of .004%. The more precise solution would be to take the sum of
P(AK=x)*P(success | AK=x) from like x=1060 to 1340 (given that the standard deviation is 34.5 AK's and the distribution is right-skewed).
I've greatly sped up the code, which is Julia btw:
Code:
function aaak(p::Float64, AK::Int64, span::Int64, coolers::Int64, sims::Int64)
successes = 0
for s=1:sims
result = [rand()<p for h=1:span]
c = count(==(1), result)
if c >= coolers
successes += 1
else
for h=span:(AK-1)
firsthand = h%span + 1
c = c - result[firsthand] + (result[firsthand] = (rand()<p))
if c >= coolers
successes += 1
break
end
end
end
end
return successes/sims
end
So for instance I typed aaak(3/245, 1207, 28, 5, 1000000)