I've been using random integers in google sheets with some formulas to simulate conditional probability problems. It takes a lot of processing power and becomes fairly limited in terms of sample size, and obviously doesn't give the exact right answer.

The question, when translated from gaming terms to a real-life scenario, goes like this:

---

**Every X seconds, on average, I flip a coin. There is a 50% chance that its heads. If I land on heads, I must stop fliping my coin for Y seconds. If I land on tails, I can proceed to flip. I stop flipping after 360 seconds.**
Let's say X = 2 and Y = 8.

My end goal is a formula that I can input:

1. The chance of success for each action | r = 50% | *Chance of heads*
2. The rate of an action being performed | x = 2 | *Rate of flipping a coin*
3. A specified time period | t = 360 | *6 minutes*

And I will get in my output:

1. The number of times that I have **on average** flipped heads in that specified time period.

---

I have asked some mathematically savvy people I know about this, and asked on a mathematics discord which directed me here :) I've thought about this problem for a while, and here's the link to a spreadsheet I made if it helps y'all understand.
I'm new here, and if there are any unspoken rules or such that I've broken, it's not out of malice. Ask me anything about my question or clarifying comments I'll be ***happy*** to help!
<https://docs.google.com/spreadsheets/d/1qEKI2ZYZzlyJ1-IP6LYhzsK3spJ-ylAC_1lCvbOzORI/edit?usp=sharing>