<p>If framed as "please check my code" it's probably going to be seen as off topic here (that may fly at say codereview; or stackoverflow might accept it depending on how it's presented). </p>

<p>If framed as a question about the methodology to solve a probability problem (rather than inherently a code problem), it might be seen as more nearly on topic here. (For an explanation of what kind of code related questions <em>can</em> be asked, see the <a href="https://stats.stackexchange.com/help/on-topic">help/on-topic</a>.)</p>

<p>If you break it into two questions ("is this a correct approach to solving the probability problem" and "does this code correctly implement the approach" you may be able to get each answered in different places).</p>
