Pure function to determine next and last ping?

A while back I made a TagTime-like system in Android Automate. Here’s some pseudo-code that represents the scheduling strategy I used:

begin
start = 6
end = 19
length = end-start
rand = random()
run = rand <= 0.1 && hour >= start && hour < end
if run:
  ping user
wait 5 minutes
goto begin

There are probably good arguments for why this approach is naive, though I couldn’t articulate them, and the strategy worked well enough for what I was doing. I did have a big discussion with some other users here on the forum regarding the nuances of stochastic time tracking and the practical issues I ran into trying to use it.

Also, if you’re interested in looking at my Automate flow, I’m happy to share more information / an export of the flow.