And since I know you're excited to know "ok but what math", well, here you go: The random walk on a one dimensional lattice with restraining barrier at the origin and absorbing barrier at N for the case where only steps of r units to the right and units to the left are allowed By Tom Lehrer et al