Let us take the 1D case: for an n-step random walk on a line confined between two boundaries at positions t and s, can we determine the average time (number of steps) the walker spends off the boundaries given the distance between the boundaries is d? That is, the time spent on all sites but t+1 (neighbouring site of the left boundary) and s-1 (neighbouring site of the right side boundary).

We can reformulate the problem in terms of the complementary scenario, meaning: what is the frequency with which the walker gets reflected from the boundaries (as a function of n and d)? It would be very interesting if someone could shed light on such properties of the finite random walker. Please let me know of anything stands vague in the above description.