is there a code for this. One solution is given in http://www.drdobbs.com/architecture-and-design/20-heads-in-a-row-what-are-the-odds/229300217 Good discussion… gives answer
MATLAB: Probability of a run of k heads or more in N tosses of a fair coin N>>k
Image Processing Toolboxprobability
Best Answer